You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: preg_*() /u on invalid UTF-8 — match succeeds, preg_last_error() stale (ext/pcre/php_pcre.c) #17503
PCRE functions with the u (UTF-8) modifier must reject malformed subject strings: return false (or false from split) and set preg_last_error() to PREG_BAD_UTF8_ERROR (4). This compiler accepts invalid bytes and leaves preg_last_error() at 0.
ext/standard/ preg builtins + VM/JIT lowering — validate subject UTF-8 when pattern carries u; propagate preg_last_error() / preg_last_error_msg() like Zend
Prefer PHP implementation; keep any C as thin PCRE ABI only
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_preg_match_invalid_utf8.phpphp bin/vm.php test/repro/maintainer_gap_preg_split_invalid_utf8.php'# Zend: ok · VM: fail on both
Done when
preg_match, preg_match_all, preg_split, preg_replace, preg_grep with /u set PREG_BAD_UTF8_ERROR on invalid UTF-8 subjects (VM + JIT/AOT where pattern is known at compile time)
Compliance .phpt guards under test/compliance/cases/pcre/
Fix:VmPregPure::ensureUtf8SubjectForOpts() validates subject UTF-8 when pattern has /u (PCRE2_UTF), sets PREG_BAD_UTF8_ERROR (4) like Zend ext/pcre/php_pcre.c.
Activity
PurHur commentedon Jul 9, 2026
claim: cursor-agent-lane-b — starting this run
PurHur commentedon Jul 9, 2026
Merged via #17512.
Fix:
VmPregPure::ensureUtf8SubjectForOpts()validates subject UTF-8 when pattern has/u(PCRE2_UTF), setsPREG_BAD_UTF8_ERROR(4) like Zendext/pcre/php_pcre.c.Verification (Docker):
php bin/vm.php test/repro/maintainer_gap_preg_match_invalid_utf8.php→false/ error 4php bin/vm.php test/repro/maintainer_gap_preg_split_invalid_utf8.php→false/ error 4php bin/vm.php test/compliance/cases/pcre/preg_utf8_invalid_subject.phpt— greenvendor/bin/phpunit --filter VmPregUtf8SubjectTest— 4/4 OKStdlib: reject invalid UTF-8 subjects for preg_* /u modifier (#17503) (…
chore: drop 24 more stale maintainer_gap repros (wave30 batch 2, #16660…