Keep polyfill stub classes in the global namespace (v1.2.7)#2
Merged
Conversation
Symfony polyfill packages ship stubs that declare Normalizer, Attribute, JsonException, PhpToken, and UnhandledMatchError in the global namespace so they serve as fallbacks when the corresponding PHP extension/version is missing. ClassmapReplacer was prefixing those stubs alongside other global classes, which broke the fallback and fatalled with "Class X not found" on servers without the native implementation (e.g. no intl ext). Extend the built-in allowlist with the five polyfilled classes plus CompileError, UnitEnum, BackedEnum, SensitiveParameter, and Override so future polyfill stubs don't regress the same way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClassmapReplacerbuilt-in allowlist with the five polyfill-stub classes that were being prefixed:Normalizer,Attribute,JsonException,PhpToken,UnhandledMatchErrorCompileError,UnitEnum,BackedEnum,SensitiveParameter,Overrideso future polyfill stubs don't regress the same wayWhy
Symfony polyfill packages (
polyfill-intl-normalizer,polyfill-php73,polyfill-php80) ship stub files that declare these classes in the global namespace specifically so they act as fallbacks when the corresponding PHP extension/version is missing. The previous allowlist coveredStringableandValueErrorbut missed the rest — so after scoping, the stubs ended up renamed (e.g.WPSmsWooProVendor_Normalizer) and no longer filled in the global\Normalizerthat the scopedsymfony/stringcode references. On servers without theintlextension this produced a fatalClass "Normalizer" not foundat install time (see WSMS support ticket #15297).Test plan
vendor/bin/phpunit— 134/134 tests passNormalizer,Attribute, and a custom global class leaves the built-ins alone and prefixes only the custom class