Skip to content

Conversation

@Firtzberg
Copy link
Contributor

Not redeclaring polyfilled classes when PHP version is 8.0 or above.
The same approach is used for the Stringable interface in this commit.

One of my scripts runs opcache_compile_file on vendor files, including symfony. I'm in the process of upgrading to PHP 8. Running opcache_compile_file on either of the modified files causes a fatal error Fatal error: Cannot declare class ValueError/UnhandledMatchError, because the name is already in use.
That's not the case on PHP versions below 8.

@Firtzberg Firtzberg changed the title Prevent redefinition of PHP 8.0 classes [PHP80]Prevent redefinition of PHP 8.0 classes Jun 5, 2021
@Firtzberg Firtzberg changed the title [PHP80]Prevent redefinition of PHP 8.0 classes [PHP80] Prevent redefinition of PHP 8.0 classes Jun 5, 2021
@Firtzberg
Copy link
Contributor Author

ping

@derrabus
Copy link
Member

derrabus commented Jun 24, 2021

One of my scripts runs opcache_compile_file on vendor files, including symfony.

As mentioned on a different issue from you, you shouldn't do that. Symfony ships classes that might require optional dependencies or a higher PHP version. Even if we apply your fix here, your script will continue to explode elsewhere.

Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the changes despite disagreeing with the motivation behind them. 😉

nicolas-grekas added a commit that referenced this pull request Sep 13, 2021
…n related class stubs. (Firtzberg)

This PR was merged into the 1.23-dev branch.

Discussion
----------

[PHP 8.1] [PHP 7.3] Preventing redeclaration of PHP version related class stubs.

Same as #359, only for other PHP version related class stubs.

Commits
-------

4cddf20 Preventing redeclaration of PHP version related class stubs.
symfony-splitter pushed a commit to symfony/polyfill-php81 that referenced this pull request Sep 13, 2021
…n related class stubs. (Firtzberg)

This PR was merged into the 1.23-dev branch.

Discussion
----------

[PHP 8.1] [PHP 7.3] Preventing redeclaration of PHP version related class stubs.

Same as symfony/polyfill#359, only for other PHP version related class stubs.

Commits
-------

4cddf20 Preventing redeclaration of PHP version related class stubs.
@nicolas-grekas
Copy link
Member

Thank you @Firtzberg.

@nicolas-grekas nicolas-grekas merged commit 5419e55 into symfony:main Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants