Skip to content

Stdlib: locale_filter_matches() JIT path throws instead of matching php-src prefix filtering (ext/intl/locale/locale_methods.c) #32119

Description

@PurHur

Category

bug · php-src-strict

Problem

locale_filter_matches() already has working PHP semantics in ext/intl/VmLocale.php, including the canonicalize-sensitive behavior covered by the existing intl compliance case. The JIT entrypoint in ext/intl/locale_filter_matches.php still throws RuntimeException: locale_filter_matches() JIT lowering not implemented; use VM, so backend selection changes observable behavior versus php-src.

Repro Zend / php-src expected JIT (2026-08-18)
locale_filter_matches("de-DE", "de", false) true RuntimeException: locale_filter_matches() JIT lowering not implemented; use VM

VM/reference confirmation in this tree today:

  • ./script/docker-exec.sh -- bash -lc 'php test/repro/issue_25198_locale_lookup_named.php' prints filter_pos=true and filter_named=true
  • ./script/docker-exec.sh -- bash -lc 'php -r '\''require \"vendor/autoload.php\"; var_dump(PHPCompiler\\ext\\intl\\VmLocale::filterMatches(\"de-DE\", \"de\", false));'\''' prints bool(true)
  • test/compliance/cases/intl/locale_filter_matches_canonicalize_20939.phpt already records php-src-strict canonicalize behavior for the VM path

php-src reference

PHP implementation target

  • ext/intl/locale_filter_matches.php — lower JIT calls instead of throwing
  • ext/intl/VmLocale.php — keep prefix-match/canonicalize semantics SSOT
  • lib/JIT/ helper if necessary, but do not move the behavior into new C/runtime branches

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/issue_25198_locale_lookup_named.php'
./script/docker-exec.sh -- bash -lc 'php -r '\''require "vendor/autoload.php"; $ctx=(new ReflectionClass("PHPCompiler\\JIT\\Context"))->newInstanceWithoutConstructor(); try { (new PHPCompiler\ext\intl\locale_filter_matches())->call($ctx); } catch (Throwable $e) { echo get_class($e),": ",$e->getMessage(),"\n"; }'\'''

Done when

  • locale_filter_matches() returns the same result on JIT as php-src/VM for ordinary and canonicalize-sensitive cases instead of throwing
  • The behavior from test/compliance/cases/intl/locale_filter_matches_canonicalize_20939.phpt is covered on the JIT path too
  • Named/optional args from test/repro/issue_25198_locale_lookup_named.php behave identically on VM and JIT
  • php-src-strict; no php-compiler-strict shortcut

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions