Repository navigation
Closed
Description
Yesterday, we discovered that recent releases of PHPUnit's PHAR are not scoped.
Release PHARs of PHPUnit are (still) built by me on my machine using the most recent stable version of PHP. It looks like all PHAR releases I created since I switched to PHP 8.5 were not scoped because PHP-Scoper does not work with PHP 8.5.
However, due to #1138 I did not see that the scoping did not work.
When I use the -vv CLI option I see why:
[php-scoper] * [NO] /usr/local/src/phpunit/build/tmp/phar/theseer-tokenizer/Tokenizer.php
[php-scoper] Could not parse the file "/usr/local/src/phpunit/build/tmp/phar/theseer-tokenizer/Tokenizer.php".: ErrorException: Method SplObjectStorage::attach() is deprecated since 8.5, use method SplObjectStorage::offsetSet() instead in phar:///usr/local/src/phpunit/tools/php-scoper/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php:1123
[php-scoper] Stack trace:
[php-scoper] #0 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php(1123): {closure:phar:///usr/local/src/phpunit/tools/php-scoper/bin/php-scoper:27}()
[php-scoper] #1 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(167): _HumbugBox2acd6fc30c41\PhpParser\Parser\Php8::{closure:_HumbugBox2acd6fc30c41\PhpParser\Parser\Php8::initReduceCallbacks():1121}()
[php-scoper] #2 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(85): _HumbugBox2acd6fc30c41\PhpParser\ParserAbstract->doParse()
[php-scoper] #3 phar:///usr/local/src/phpunit/tools/php-scoper/src/Scoper/PhpScoper.php(37): _HumbugBox2acd6fc30c41\PhpParser\ParserAbstract->parse()
[php-scoper] #4 phar:///usr/local/src/phpunit/tools/php-scoper/src/Scoper/PhpScoper.php(30): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Scoper\PhpScoper->scopePhp()
[php-scoper] #5 phar:///usr/local/src/phpunit/tools/php-scoper/src/Scoper/PatchScoper.php(15): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Scoper\PhpScoper->scope()
[php-scoper] #6 phar:///usr/local/src/phpunit/tools/php-scoper/src/Console/ConsoleScoper.php(136): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Scoper\PatchScoper->scope()
[php-scoper] #7 phar:///usr/local/src/phpunit/tools/php-scoper/src/Console/ConsoleScoper.php(82): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Console\ConsoleScoper->scopeFile()
[php-scoper] #8 phar:///usr/local/src/phpunit/tools/php-scoper/src/Console/ConsoleScoper.php(56): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Console\ConsoleScoper->scopeFiles()
[php-scoper] #9 phar:///usr/local/src/phpunit/tools/php-scoper/src/Console/ConsoleScoper.php(43): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Console\ConsoleScoper->doScope()
[php-scoper] #10 phar:///usr/local/src/phpunit/tools/php-scoper/src/Console/Command/AddPrefixCommand.php(63): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Console\ConsoleScoper->scope()
[php-scoper] #11 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/fidry/console/src/Bridge/Command/SymfonyCommand.php(69): _HumbugBox2acd6fc30c41\Humbug\PhpScoper\Console\Command\AddPrefixCommand->execute()
[php-scoper] #12 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/symfony/console/Command/Command.php(151): _HumbugBox2acd6fc30c41\Fidry\Console\Bridge\Command\SymfonyCommand->execute()
[php-scoper] #13 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/symfony/console/Application.php(720): _HumbugBox2acd6fc30c41\Symfony\Component\Console\Command\Command->run()
[php-scoper] #14 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/symfony/console/Application.php(243): _HumbugBox2acd6fc30c41\Symfony\Component\Console\Application->doRunCommand()
[php-scoper] #15 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/symfony/console/Application.php(136): _HumbugBox2acd6fc30c41\Symfony\Component\Console\Application->doRun()
[php-scoper] #16 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/fidry/console/src/Application/ApplicationRunner.php(39): _HumbugBox2acd6fc30c41\Symfony\Component\Console\Application->run()
[php-scoper] #17 phar:///usr/local/src/phpunit/tools/php-scoper/vendor/fidry/console/src/Application/ApplicationRunner.php(28): _HumbugBox2acd6fc30c41\Fidry\Console\Application\ApplicationRunner->run()
[php-scoper] #18 phar:///usr/local/src/phpunit/tools/php-scoper/bin/php-scoper(49): _HumbugBox2acd6fc30c41\Fidry\Console\Application\ApplicationRunner::runApplication()
[php-scoper] #19 /usr/local/src/phpunit/tools/php-scoper(20): require('...')
[php-scoper] #20 {main}
This appears to be another issue (like #1092 was) with PHP-Scoper's error handler turning E_DEPRECATED issues into exceptions. Only this time, due to #1138, we do not see the crash unless we use -vv.
Reacted by Daniel Morell, Kostiantyn Miakshyn, JR Tashjian and Marcel Klehr
Metadata
Metadata
Assignees
Labels
No labels
Activity
sebastianbergmann commentedon Dec 2, 2025
My suggestions would be:
E_DEPRECATEDissues into exceptionsdavidbarratt commentedon Jan 3, 2026
It would be really helpful for us if the
composer.jsonwas updated to not declare that PHP 8.5 is supported when in reality it silently fails.theofidry commentedon Jan 3, 2026
That ship has sailed unfortunately. And I tend to not be too strict on the PHP requirements unless absolutely needed because it's an additional maintenance burden and break on adoption when new versions are out. I appreciate it's not a universally shared opinion, but it is what it is.
This one is particularly annoying though I'll get to it next week.
marcelklehr commentedon Feb 12, 2026
@theofidry Looking forward to your fix, whenever you get to it 💙
swissspidy commentedon Feb 18, 2026
There's also
Using null as an array offset is deprecated, use an empty string insteadhere:php-scoper/src/PhpParser/NodeVisitor/UseStmt/UseStmtCollection.php
Line 56 in ed524a3
theofidry commentedon Feb 21, 2026
Hmm the last one seems to be an issue from PHP-Parser and either I missed an update or it's still there.
I'll diable the throwing exceptions on deprecations to get by it.
fix: install Infection via Composer to fix PHP 8.5 compatibility
fix: install Infection via Composer to fix PHP 8.5 compatibility (#4)
theofidry commentedon Mar 2, 2026
Fixed in https://github.com/humbug/php-scoper/releases/tag/0.18.19