Category
stdlib
Problem
similar_text() VM supports the optional third by-reference $percent argument; JIT/AOT reject three-arg calls at compile/lowering time. Framework code and PHPT suites that capture similarity percentage cannot run under bin/jit.php or AOT.
Phase 2 of closed #2445 (two-arg VM/JIT shipped).
php-src reference
Repro
VM (passes today)
<?php
$p = 0;
similar_text('hello', 'hallo', $p);
echo $p, "\n"; // Zend + bin/vm.php: 80
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
php repro.php
JIT/AOT (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php repro.php'
# LogicException from ext/standard/similar_text.php:
# similar_text() JIT/AOT only supports two arguments in this compiler build; use bin/vm.php for &$percent
Two-arg calls (similar_text($a, $b)) must remain green.
Scope (this repo)
| Layer |
Files |
Notes |
| VM |
ext/standard/similar_text.php |
Reference write to $percent (baseline — do not regress) |
| JIT |
ext/standard/similar_text.php::call(), lib/JIT/Builtin/StringSimilarText.php (or existing helper) |
Emit percent write-back via indirect slot / param-by-ref pattern (#3161) |
| AOT |
shared JIT builtin |
Same LLVM path as JIT |
| Tests |
test/compliance/cases/stdlib/similar_text_percent.phpt |
VM + JIT; assert $p === 80 for repro strings |
Reference-arg pattern: compare preg_match $matches JIT deferrals and closure use (&$x) (#3108).
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter similar_text_percent'
Related
Category
stdlibProblem
similar_text()VM supports the optional third by-reference$percentargument; JIT/AOT reject three-arg calls at compile/lowering time. Framework code and PHPT suites that capture similarity percentage cannot run underbin/jit.phpor AOT.Phase 2 of closed #2445 (two-arg VM/JIT shipped).
php-src reference
ext/standard/string.c—php_similar_text(),percentout-parameterext/standard/basic_functions.stub.php—similar_textsignature with optional&$percentRepro
VM (passes today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php' php repro.phpJIT/AOT (failure today)
Two-arg calls (
similar_text($a, $b)) must remain green.Scope (this repo)
ext/standard/similar_text.php$percent(baseline — do not regress)ext/standard/similar_text.php::call(),lib/JIT/Builtin/StringSimilarText.php(or existing helper)test/compliance/cases/stdlib/similar_text_percent.phpt$p === 80for repro stringsReference-arg pattern: compare
preg_match$matchesJIT deferrals and closureuse (&$x)(#3108).Done when
80underbin/jit.php(native MCJIT, no VM fallback)./script/ci-fast.sh --filter similar_text_percentgreendocs/capabilities.mdregenerated if JIT notes changeVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter similar_text_percent'Related