Category
bug · AOT · mbstring · leftover of #34625 / peer #4405
Problem
mb_strlen($s, $encoding) with a runtime encoding variable works under AOT after #34625, but mb_strtolower / mb_strtoupper / mb_ucfirst / mb_lcfirst still fail at compile time:
mb case JIT encoding must be a string literal in this compiler build
VM matches Zend. Literal encoding already works via NestedJIT MbCaseJitHelper.
| Repro |
Zend 8.2+ |
AOT (master @ 74e8a5e) |
$e='UTF-8'; echo mb_strtolower('Ä', $e); |
ä |
LogicException at compile |
$e='UTF-8'; echo mb_strtoupper('ä', $e); |
Ä |
same |
$e='UTF-8'; echo mb_ucfirst('äx', $e); |
Äx |
same (mb_ucfirst()/mb_lcfirst() encoding must be a string literal…) |
Root cause: JitMbCase::runtimeEncodingLiteral / JitMbUcfirstLcfirst::runtimeEncodingLiteral require TYPE_STRING + compileTimeString. Runtime locals are TYPE_VALUE.
./script/aot-smoke.sh is 8/8.
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/x test/repro/stdlib-aot/mb_strtolower_enc.php'
Done when
Category
bug· AOT · mbstring · leftover of #34625 / peer #4405Problem
mb_strlen($s, $encoding)with a runtime encoding variable works under AOT after #34625, butmb_strtolower/mb_strtoupper/mb_ucfirst/mb_lcfirststill fail at compile time:VM matches Zend. Literal encoding already works via NestedJIT
MbCaseJitHelper.$e='UTF-8'; echo mb_strtolower('Ä', $e);ä$e='UTF-8'; echo mb_strtoupper('ä', $e);Ä$e='UTF-8'; echo mb_ucfirst('äx', $e);Äxmb_ucfirst()/mb_lcfirst() encoding must be a string literal…)Root cause:
JitMbCase::runtimeEncodingLiteral/JitMbUcfirstLcfirst::runtimeEncodingLiteralrequireTYPE_STRING+compileTimeString. Runtime locals areTYPE_VALUE../script/aot-smoke.shis 8/8.php-src reference
ext/mbstring/mbstring.c—PHP_FUNCTION(mb_strtolower|mb_strtoupper|mb_ucfirst|mb_lcfirst)PHP implementation target
ext/mbstring/JitMbCase.php/JitMbUcfirstLcfirst.php— NestedJIT runtime encoding path (peerJitMbStrlenAOT: mb_strlen() refuses runtime encoding string — LogicException (leftover of #4405, ext/mbstring/mbstring.c) #34625)ext/mbstring/MbCaseJitHelper.php— validate encoding at runtime (ValueError), NestedJIT-safeRepro
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/x test/repro/stdlib-aot/mb_strtolower_enc.php'Done when
./script/aot-smoke.shstays 8/8