symfony: phpunit-bridge breaks with phpunit 9.1.2

Hi,

Since phpunit 9.1.2, the bridge fails with this error:

PHP Fatal error:  Uncaught Error: Access to undeclared static property: PHPUnit\Util\Blacklist::$blacklistedClassNames in /dir/bin/.phpunit/phpunit-9.1-0/phpunit:13
Stack trace:
#0 /dir/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php(343): include()
#1 /dir/bin/phpunit(13): require('/home/jmsche/Si...')
#2 {main}
  thrown in /dir/bin/.phpunit/phpunit-9.1-0/phpunit on line 13

After a little research, I found the commit that breaks it: https://github.com/sebastianbergmann/phpunit/commit/2b4d7b8bb3fd052095e64999990cc36b63aa0771

So phpunit switches from a public static var to a private constant.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 18
  • Comments: 21 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Sebastian was so kind to suggest a solution on his side: https://github.com/sebastianbergmann/phpunit/issues/4186#issuecomment-617726393

For those who came here for quick solution: set in composer.json fixed phpunit version. "phpunit/phpunit": "9.1.1" (not "phpunit/phpunit": "^9.0")

Can anyone look into an alternative implementation? If none is possible, a report to phpunit might still have to be considered.

Ok, I’ve removed the vendor phpunit package. Now it works with version 9.1.1. Thank you.

Looks like you have PHPUnit installed in bin and in vendor at the same time.

@jmsche

I would not go as far as blaming phpunit/phpunit for breaking changes here - PHPUnit\Util\Blacklist has been marked as @internal 15 months ago.