Skip to content

AOT: mb_scrub() refuses runtime strings — LogicException (leftover of #6050, ext/mbstring/mbstring.c) #34338

Description

@PurHur

Category

bug · AOT mbstring NestedJIT leftover of #6050

Problem

mb_scrub() matches Zend on the VM for runtime invalid UTF-8, but thin standalone AOT refuses non-literal $string with:

mb_scrub() JIT requires compile-time string and encoding literals in this compiler build

Literal folds already work via JitMbScrub::tryCompileTimeFold. Peer leftovers (#34309 mb_convert_encoding, #34298 mb_preferred_mime_name) used NestedJIT helpers for the same gap.

Verified on master @ c34c5b0 (aot-smoke 8/8):

Repro Zend 8.2 AOT
$s = 'a' . chr(0x80) . 'b'; echo bin2hex(mb_scrub($s)); 613f62 compile LogicException

php-src reference

PHP implementation target

  • ext/mbstring/JitMbScrub.php — NestedJIT runtime path (peer JitMbConvertEncoding)
  • ext/mbstring/MbScrubJitHelper.php + lib/JIT/Builtin/MbScrubRuntime.php — php-in-PHP helper
  • ext/mbstring/mb_scrub.php — wire call() through invoke

Repro

./script/aot-smoke.sh   # must stay 8/8
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/aot_mb_scrub_runtime.php'
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/mbscrub.bin test/repro/aot_mb_scrub_runtime.php && /tmp/mbscrub.bin'

Done when

  • Runtime-string mb_scrub() AOT matches Zend (UTF-8 / ASCII / 8BIT)
  • ./script/aot-smoke.sh still 8/8
  • No new runtime/*.c — NestedJIT only

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 appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions