Skip to content

Regression: AOT array_walk_recursive() segfaults after build — VM/JIT match Zend (ext/standard/array.c) #27632

Description

@PurHur

Category

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

Problem

array_walk_recursive matches Zend on VM and JIT, but thin AOT segfaults after a successful build (happy path and null). Sibling of open #26969 (array_walk AOT segfault). Probed 2026-08-04 @ fb10b03c1.

Repro Zend / VM / JIT AOT (phpc build, ×3)
$a=[1,[2]]; array_walk_recursive($a, fn(&$v)=>$v*=10); echo … 10,20 segfault fatal signal after c:main_before_php (exit 139, 3/3)
array_walk_recursive(null, …) under try/catch TypeError:…null given same segfault (exit 139, 3/3) — never reaches TypeError

php-src reference

PHP implementation target

  • AOT/JIT walk-recursive lowering in ext/standard + lib/JIT/ (PHP helpers; align with array_walk fix)
  • PHP-in-PHP; no new C runtime branches

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/awr_ok.php <<'"'"'PHP'"'"'
<?php
$a = [1, [2]];
array_walk_recursive($a, function (&$v) { $v *= 10; });
echo $a[0] . "," . $a[1][0];
PHP
php /tmp/awr_ok.php
php bin/vm.php /tmp/awr_ok.php
php bin/jit.php /tmp/awr_ok.php
./phpc build -o /tmp/awr_ok.bin /tmp/awr_ok.php && /tmp/awr_ok.bin
# repeat binary ≥3× — exit 139 every run on 2026-08-04
'

Done when

  • AOT happy-path output matches Zend/VM/JIT (10,20) on ≥3 consecutive runs
  • AOT array_walk_recursive(null, …) throws catchable TypeError (not segfault)
  • Targeted AotTest / compliance guard
  • php-src-strict; no php-compiler-strict shortcut

Gate context (same machine, 2026-08-04)

No activity

Activity on this issue will appear here.

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