Category
stdlib — php-src-strict
Problem
Zend preg_filter() rejects enum case $subject operands with catchable TypeError (Argument #3 ($subject) must be of type array|string, … given). This compiler's ext/standard/preg_filter.php uses VmReflection::stringArg() / array checks that throw LogicException (preg_filter() subject must be a string or array in this compiler build) instead of TypeError.
Pairs #5859 (preg_replace() subject) and #5999 (other preg_* enum operands). preg_filter is not listed there.
php-src reference
PHP implementation target
Repro
test/repro/maintainer_preg_filter_enum.php:
<?php
declare(strict_types=1);
enum Color: string { case Red = 'red'; }
try {
preg_filter('/red/', 'x', Color::Red);
} catch (Throwable $e) {
echo get_class($e) . ': ' . $e->getMessage() . "\n";
}
./script/docker-exec.sh -- bash -lc '
php test/repro/maintainer_preg_filter_enum.php
php bin/vm.php test/repro/maintainer_preg_filter_enum.php
'
Zend: TypeError: preg_filter(): Argument #3 ($subject) must be of type array|string, Color given
VM (current): preg_filter() subject must be a string or array in this compiler build
Verification
test/compliance/cases/stdlib/preg_filter_enum_typeerror.phpt
- VM parity first; JIT when
JitPregFilter is wired
claim
Maintainer filed 2026-06-06 — live repro.
Category
stdlib— php-src-strictProblem
Zend
preg_filter()rejects enum case$subjectoperands with catchableTypeError(Argument #3 ($subject) must be of type array|string, … given). This compiler'sext/standard/preg_filter.phpusesVmReflection::stringArg()/ array checks that throwLogicException(preg_filter() subject must be a string or array in this compiler build) instead ofTypeError.Pairs #5859 (
preg_replace()subject) and #5999 (otherpreg_*enum operands).preg_filteris not listed there.php-src reference
ext/pcre/php_pcre.cext/standard/preg.c—preg_filterPHP implementation target
ext/standard/preg_filter.php—VmString::coerceStringBuiltinArg()+ enum-case rejection before coercionext/standard/JitPregFilter.php(pairs Stdlib: preg_filter() $limit / $flags — JIT/AOT lowering (ext/pcre/php_pcre.c parity) #4079)Repro
test/repro/maintainer_preg_filter_enum.php:Zend:
TypeError: preg_filter(): Argument #3 ($subject) must be of type array|string, Color givenVM (current):
preg_filter() subject must be a string or array in this compiler buildVerification
test/compliance/cases/stdlib/preg_filter_enum_typeerror.phptJitPregFilteris wiredclaim
Maintainer filed 2026-06-06 — live repro.