You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AOT: str_pad() segfaults — three-argument literal call is enough #23911
str_pad() segfaults in an AOT binary. A single call with all literal arguments is enough; no
computed arguments, no variables, no other code required.
VM is unaffected.
Reproducer
<?phpechostr_pad('p', 5, '-'), "\n";
zend: p----
aot : phpc: fatal signal (segfault) after c:main_before_php
Argument form is irrelevant
program
AOT
str_pad('p', 5, '-') — all literals
segfault
$x=5; str_pad('p', $x, '-') — variable length
segfault
$x=3; str_pad('p', $x+2, '-') — computed length
segfault
So this is not the computed-argument / packed-argv path that #23871 was about. str_pad itself is
broken.
substr() is fine, for contrast
Same file shape, same argument forms, no crash:
<?phpechosubstr('abcdefgh', 1, 4), "\n"; // ok — bcde<?php$x=3; echosubstr('abcdefgh', $x-2, $x+1), "\n"; // ok — bcde
That narrows it to str_pad's own lowering rather than string builtins generally.
Note on the marker
The crash reports after c:main_before_php, i.e. it does not reach user code output. Worth checking
whether the fault is at the call site or in str_pad's emitted body/registration.
Blast radius
Accounts for two standing AOT differential failures:
c11_strcmp.php — str_pad('p',$x+2,'-') then substr(...)
e15_str_fns.php — str_pad($s,$n+13,".") then substr(...) then str_replace(...)
Both were previously recorded only as "segfault" at case level; this pins the function.
Companion: str_replace() returning Array under AOT is #23912. e15_str_fns.php hits both, so it needs both before it passes; c11_strcmp.php needs only this one.
Activity
PurHur commentedon Jul 27, 2026
Companion:
str_replace()returningArrayunder AOT is #23912.e15_str_fns.phphits both, so it needs both before it passes;c11_strcmp.phpneeds only this one.PurHur commentedon Jul 27, 2026
claim: Lane B implementer — starting this run
AOT: inline str_pad helper — stop NestedJIT VmString null segfault (#…
PurHur commentedon Jul 27, 2026
merged: #23931
Fix: inline pad loop in
StrPadJitHelper(stop NestedJITVmString::strPadnull — peer #23204);StringStrPadNestedJitCompileScope guard.Verified:
php bin/compile.php -o … test/repro/issue23911_str_pad_aot.php && …→p----×3, exit 0 (was segfault afterc:main_before_php)vendor/bin/phpunit --filter StrPadRuntimeShrinkTestOKstr_pad/str_pad_literal_segfault/str_pad_named_paramsOKc11_strcmp.phpAOT →p----/bcdeAOT: str_replace scalar subject returns replaced string (#23912) (#23940