Skip to content

Regression: AOT preg_split() returns empty — VM/JIT match Zend (re-#27080, ext/pcre/php_pcre.c) #27208

Closed

Description

@PurHur

Category

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

Problem

preg_split matches Zend on VM/JIT, but thin AOT builds successfully then prints empty stdout (exit 0) — silent wrong output. Closed #27080 was an AOT compile type-mismatch; this is the post-fix runtime gap (2026-08-03, 1833761dc).

Repro Zend / VM / JIT AOT
implode(",", preg_split("/\\s+/", "a b c")) a,b,c (empty)

Peer open AOT PCRE: #27195 (preg_match_all abort), #27181 (preg_filter abort) — different symptoms.

php-src reference

PHP implementation target

  • NestedJIT / PregSplit helper return value materialization for thin AOT — array of strings must survive to echo/implode like VM
  • Keep behavior in ext/pcre + lib/JIT PHP; no new runtime/*.c split logic

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/aot_preg_split.php <<'"'"'PHP'"'"'
<?php
echo implode(",", preg_split("/\s+/", "a  b c")), "\n";
PHP
php /tmp/aot_preg_split.php
php bin/vm.php /tmp/aot_preg_split.php
php bin/jit.php /tmp/aot_preg_split.php
PHP_COMPILER_HELPER_RUNTIME_O=0 ./phpc build -o /tmp/aot_preg_split /tmp/aot_preg_split.php && /tmp/aot_preg_split
'

Done when

  • AOT prints a,b,c matching Zend/VM/JIT
  • Prefer --repeat 10 if memory-safety suspected
  • Repro/compliance guard; php-src-strict only

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 3, 2026
  2. PurHur commented on Aug 3, 2026

    @PurHur
    OwnerAuthor

    claim: Worker Lane B — starting this run

    Pre-triage gates (master workspace)

  3. PurHur commented on Aug 3, 2026

    @PurHur
    OwnerAuthor

    merged: #27466

    Verification

    • Issue repro AOT ×10: a,b,c (HELPER_RUNTIME_O=0 and default helper cache)
    • Dynamic $p/$s AOT also a,b,c
    • vendor/bin/phpunit --filter 'PregAotFastPathTest|PregMatchRuntimeShrinkTest|PregSplitBuiltinTest' OK (17)
    • spine coverage sync + bootstrap-inventory --check OK 6932/6932
  4. PurHur commented on Aug 3, 2026

    @PurHur
    OwnerAuthor

    Merged as 5853164b2 via #27466 (squash).

    Re-verified after rebase onto master: AOT repro prints a,b,c; PregSplitBuiltinTest OK.

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