Skip to content

Regression: AOT mb_substr() not lowered — compile fails; VM/JIT match Zend (ext/mbstring/mbstring.c) #27028

Description

@PurHur

Category

bug · php-src-strict · AOT · pillar 4

Problem

mb_substr(\"abcdef\", 2, 2) is cd on Zend/VM/JIT, but AOT compile aborts with mb_substr() is not lowered for JIT/AOT in this compiler build (ext/mbstring/mb_substr.php call()).

Repro Zend / VM / JIT (2026-08-02, 8f314121e) AOT
echo mb_substr(\"abcdef\", 2, 2), PHP_EOL; cd compile fails (LogicException)

Note: JIT succeeds (likely VM-execute fallback); only standalone AOT requires the missing call() lowering.

php-src reference

PHP implementation target

  • ext/mbstring/mb_substr.php + new/extend ext/mbstring/JitMb* / lib/JIT/Builtin/ — PHP-in-PHP lowering; do not grow runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/aot_mb_substr.php <<'"'"'PHP'"'"'
<?php
echo mb_substr(\"abcdef\", 2, 2), PHP_EOL;
PHP
echo -n \"zend=\"; php /tmp/aot_mb_substr.php
echo -n \"vm=\"; php bin/vm.php /tmp/aot_mb_substr.php 2>/dev/null
echo -n \"jit=\"; php bin/jit.php /tmp/aot_mb_substr.php 2>/dev/null
php bin/compile.php -o /tmp/aot_mb_substr /tmp/aot_mb_substr.php && /tmp/aot_mb_substr
'

Done when

  • AOT binary prints cd
  • Prefer --repeat 10 on the built binary
  • Compliance or test/repro/ / AOT fixture guard
  • php-src-strict; no php-compiler-strict shortcut

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