v1.2.5 - Fix use-as-alias form in NamespaceReplacer
Fixed
-
use Namespace as Alias;form not prefixedWhen a
usestatement imported a namespace itself (no trailing class) with an alias — e.g.use Symfony\Polyfill\Mbstring as p;in Symfony polyfill bootstrap files —NamespaceReplacerleft it unchanged. After scoping, the aliased reference resolved to a non-existent class and produced fatalClass not founderrors at runtime on hosts where the polyfill code path actually executed (e.g. servers without the nativembstringextension).Pattern 3 in
NamespaceReplacernow accepts an optionalas <alias>group between the namespace and the trailing semicolon, and preserves the alias verbatim in the replacement.Regression tests added covering both the alias form and the no-double-prefix case.
Affected plugins
Any plugin scoped with wp-scoper that pulls in Symfony polyfill packages (polyfill-mbstring, polyfill-ctype, polyfill-intl-grapheme, polyfill-intl-normalizer, polyfill-php73, polyfill-php80) and runs on a host missing the corresponding native PHP extension. Symptom: fatal Class Symfony\Polyfill\<Name>\<Name> not found from cron or page load.
Action required
Re-run composer update veronalabs/wp-scoper in affected plugins to regenerate the scoped polyfill bootstraps.