Category
bug · AOT · stdlib · mbstring · NestedJIT · php-src-strict
Problem
After #34858 / #34875 / #34880 wave, mb_strwidth() / mb_strimwidth() still refuse a runtime encoding string (JitMbStrwidth throws LogicException: … encoding must be a string literal). Invalid encoding literals also abort compile via VmMbstring::strwidth fold instead of a catchable runtime ValueError.
| Repro |
Zend 8.2+ |
AOT (master @ 8a29eaf) |
mb_strwidth('über', enc()) with enc()=>'UTF-8' |
int(4) |
compile: LogicException encoding must be a string literal |
mb_strimwidth('übercafé', 0, 5, '...', enc()) |
üb... |
same LogicException |
$e='NOPE'; try { mb_strwidth('x',$e); } catch (ValueError) |
catchable ValueError |
compile-time uncaught ValueError |
./script/aot-smoke.sh is 8/8. Peer closed: #34858, #34875, #34880.
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
export PHP_COMPILER_HELPER_RUNTIME_O=0
php bin/compile.php -o /tmp/t.bin test/repro/mb_strwidth_runtime_encoding_aot.php && /tmp/t.bin
php test/repro/mb_strwidth_runtime_encoding_aot.php
'
Done when
Category
bug· AOT · stdlib · mbstring · NestedJIT · php-src-strictProblem
After #34858 / #34875 / #34880 wave,
mb_strwidth()/mb_strimwidth()still refuse a runtime encoding string (JitMbStrwidththrowsLogicException: … encoding must be a string literal). Invalid encoding literals also abort compile viaVmMbstring::strwidthfold instead of a catchable runtimeValueError.mb_strwidth('über', enc())withenc()=>'UTF-8'int(4)LogicExceptionencoding must be a string literalmb_strimwidth('übercafé', 0, 5, '...', enc())üb...$e='NOPE'; try { mb_strwidth('x',$e); } catch (ValueError)./script/aot-smoke.shis 8/8. Peer closed: #34858, #34875, #34880.php-src reference
ext/mbstring/mbstring.c—PHP_FUNCTION(mb_strwidth)/PHP_FUNCTION(mb_strimwidth)PHP implementation target
ext/mbstring/JitMbStrwidth.php— NestedJIT encoding ptr +assertEncodingArgv(peerJitMbStrcut/ AOT: mb_substr()/mb_strcut() refuse runtime encoding — LogicException (leftover of #34256, ext/mbstring/mbstring.c) #34875); only fold when encoding is a supported canonext/mbstring/MbStrwidthJitHelper.php— int-returningassertEncodingArgv(inline canon; no private helper); Argument Php stdlib specs implementation #2 for strwidth, Stdlib: floatval, boolval, gettype(null) and expanded PHPT specs #5 for strimwidthlib/JIT/Builtin/MbStrwidth.php— register assert helperruntime/*.cRepro
Done when
./script/aot-smoke.shstays 8/8runtime/*.c