Skip to content

AOT: mb_trim()/mb_ltrim()/mb_rtrim() refuse runtime encoding — LogicException (leftover of #34379, ext/mbstring/mbstring.c) #35199

Description

@PurHur

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

  • AOT binary matches VM on runtime 8BIT/ASCII/UTF-8 encodings
  • Invalid runtime encoding raises Zend ValueError under AOT (and VM)
  • ./script/aot-smoke.sh stays 8/8
  • No new hand-written C runtime

Parent

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