-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.1-beta1 causes fatal error when running from Phar #4740
Comments
Note: I've opened this issue here as the error notice indicates it is a problem with the Phar missing a file. |
The PHAR for PHPUnit 9.5.7 was built with As you can see here, the PHAR built from the current state of Thank you for bringing this to my attention. We now test the PHAR against all supported versions of PHP instead of just one. |
Oh-kay, this is more complex than originally thought. The deprecation notices are fixed in require __DIR__ . '/../vendor/phar-io/manifest/src/values/AuthorCollection.php';
require __DIR__ . '/../vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php'; which results in
Changing require __DIR__ . '/../vendor/phar-io/manifest/src/values/AuthorCollection.php';
require __DIR__ . '/../vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php'; to require __DIR__ . '/../vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php';
require __DIR__ . '/../vendor/phar-io/manifest/src/values/AuthorCollection.php'; fixes this. However, this certainly will break at some point in the future when additional compile-time checks are added to PHP. The only solution I see is to stop using a static autoloader for the PHAR. This was required in the past for preventing errors in environments where users run PHPUnit from a PHAR in a project where (a different version of) PHPUnit is also installed using Composer. This was before we had scoped PHARs. Regarding the topological sorting of code units performed by PHPAB: that is a different topic (for a different repository). I suspect that PHPAB's sorter does not look at return type declarations (yet) as it should have otherwise detected the cyclic dependency between |
@nikic ping to let you know that these recent changes in PHP 8.1 caused an issues that was unexpected, at least to me. Maybe this should be noted in the upgrading notes? |
Current status: PHARs built from When support for PHPUnit 8.5 for newer PHP versions was decided, we forgot to backport build pipeline improvements to the |
Thanks @sebastianbergmann for your swift action on this and the detailed analysis. I'd seen the PHP 8.1 update commits in Phar.io before I opened this issue, but as they didn't seem to involve the classes mentioned in the error, I had a feeling this was going to be more complex than just updating. |
I have raised a question about this on the PHP development mailinglist. |
Setting |
As of d7258e0, PHPUnit now errors out when it detects that it was invoked from a PHAR but its code is autoloaded from a different source such as a Composer-managed installation. |
Instead of replacing static loading with autoloading we now combine the best of both worlds. The PHAR now loads all sourcecode files bundled in it on startup (again), but assisted by an autoloader so that PHP's compiler can find code units that have not been loaded yet for perming method compatibility checks, for instance.
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Ref: sebastianbergmann/phpunit#4740
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Ref: sebastianbergmann/phpunit#4740
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Ref: sebastianbergmann/phpunit#4740
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
The latest release of the PHPUnit Phar still contains an incompatibility with PHP 8.1-beta1 (and higher). Using a Composer installed version of PHPUnit will not hit this incompatibility. However, installing via Composer does require to use the `--ignore-platform-reqs` option, for now, as `phpspec/prophecy`, one of PHPUnit's dependencies does not yet allow for installation on PHP 8.1. And as this package is one of the dependencies for PHPUnit itself, we also need to tell Composer via `COMPOSER_ROOT_VERSION` to allow for this package as-is. **Important**: Once PHPUnit 9.5.8 has been released, this commit should be reverted. Refs: * sebastianbergmann/phpunit#4740 * https://getcomposer.org/doc/articles/troubleshooting.md#dependencies-on-the-root-package
* detect when we've reached the end of input when lexing an unterminated string * added a mode where we throw exceptions for invalid syntax * added tests for invalid syntax, in both default and exception mode * documented `$parser->throw_on_bad_syntax` * get tests running again on php 8.1 (broken by sebastianbergmann/phpunit#4740)
Resolve PHP Fatal error: Cannot acquire reference to $GLOBALS in vendor/phpunit/phpunit/src/Util/Configuration.php on line 407 by requiring 8.5.14 or higher. Bump minimum phpunit from 8.5.14 to 8.5.19 to address issues resolved in sebastianbergmann/phpunit#4740 Adjustments to Laravel Framework and PHPUnit min versions Adjustments to GH Action's minimum Laravel Framework version. Workflow adjustments
Summary
When I try to run any test suite on PHP 8.1.0-beta1 using the PHPUnit phar, it results in:
Current behavior
I tested with the same PHPUnit/PHP combination against various test suites. All resulted in the above error. No tests are run.
How to reproduce
Expected behavior
For the tests to run 😉
The text was updated successfully, but these errors were encountered: