Category
bug · AOT mbstring leftover · compile abort
Problem
#34379 NestedJIT'd runtime haystacks for mb_trim/mb_ltrim/mb_rtrim, but JitMbTrim::runtimeEncodingLiteral still requires a compile-time encoding string and throws LogicException when $encoding is runtime. Thin AOT cannot compile mb_trim($s, null, enc('UTF-8')).
Repro (PROFILE=8.4) |
VM |
AOT (master) |
mb_trim(" a ", null, enc('UTF-8')) |
a |
compile LogicException: encoding must be a string literal |
mb_trim(" a ", null, enc('nope')) |
Zend ValueError |
same compile abort |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'export PHP_COMPILER_PROFILE=8.4
php bin/vm.php test/repro/aot_mb_trim_runtime_encoding.php
php bin/compile.php -o /tmp/mbtrim.bin test/repro/aot_mb_trim_runtime_encoding.php && /tmp/mbtrim.bin'
Done when
Parent
Category
bug· AOT mbstring leftover · compile abortProblem
#34379NestedJIT'd runtime haystacks formb_trim/mb_ltrim/mb_rtrim, butJitMbTrim::runtimeEncodingLiteralstill requires a compile-time encoding string and throwsLogicExceptionwhen$encodingis runtime. Thin AOT cannot compilemb_trim($s, null, enc('UTF-8')).PROFILE=8.4)mb_trim(" a ", null, enc('UTF-8'))aLogicException: encoding must be a string literalmb_trim(" a ", null, enc('nope'))ValueErrorphp-src reference
ext/mbstring/mbstring.c—PHP_FUNCTION(mb_trim)PHP implementation target
ext/mbstring/JitMbTrim.php— runtime encoding via NestedJIT assert + ptr (peerJitMbScrub/ AOT: mb_scrub() refuses runtime encoding — LogicException (leftover of #34338, ext/mbstring/mbstring.c) #35161 / AOT: mb_convert_kana() refuses runtime encoding — LogicException (leftover of #34294, ext/mbstring/mbstring.c) #35193)ext/mbstring/MbTrimJitHelper.php—assertEncodingArgv(Argument Stdlib: ceil, floor, intval and expanded PHPT specs #3)lib/JIT/Builtin/MbTrimRuntime.php— link assert helperruntime/*.cRepro
Done when
8BIT/ASCII/UTF-8encodingsValueErrorunder AOT (and VM)./script/aot-smoke.shstays 8/8Parent