Skip to content

AOT: mb_convert_case(MB_CASE_TITLE) refuses runtime encoding — LogicException (leftover of #34284, ext/mbstring/mbstring.c) #35151

Description

@PurHur

Category

bug · AOT · stdlib · mbstring · NestedJIT leftover

Problem

mb_convert_case(..., MB_CASE_TITLE, $encoding) with a runtime encoding string fails at AOT compile with LogicException: mb_convert_case() encoding must be a string literal. UPPER/LOWER already accept runtime encoding via JitMbCase (#34858). TITLE still requires a compile-time literal (JitMbConvertCase::runtimeEncodingFromCaseArgs).

Repro Zend / VM AOT (bin/compile.php)
$e='UTF-8'; echo mb_convert_case('ab', MB_CASE_UPPER, $e); AB AB
$e='UTF-8'; echo mb_convert_case('ab', MB_CASE_TITLE, $e); Ab compile fails LogicException
echo mb_convert_case('istanbul', MB_CASE_TITLE, 'UTF-8'); Istanbul Istanbul

php-src reference

PHP implementation target

Repro

./script/aot-smoke.sh   # must stay 8/8
./script/docker-exec.sh -- bash -lc 'printf "%s\n" "<?php" "\$e=\"UTF-8\";" "echo mb_convert_case(\"ab\", MB_CASE_TITLE, \$e);" > /tmp/t.php; php /tmp/t.php; php bin/vm.php /tmp/t.php; php bin/compile.php -o /tmp/t.bin /tmp/t.php && /tmp/t.bin; echo'

Done when

  • AOT matches Zend/VM for TITLE/TITLE_SIMPLE with runtime encoding
  • Invalid runtime encoding → catchable ValueError Argument Stdlib: ceil, floor, intval and expanded PHPT specs #3 (not LogicException / SIGSEGV)
  • ./script/aot-smoke.sh still 8/8
  • Unit/repro guard + ./script/phpunit.sh --filter MbConvertCaseRuntimeAotTest

Parent / peers

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 apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions