Skip to content

Regression: AOT str_pad() drops pad string — prints "a" not "a...." (re-#23911, ext/standard/string.c) #26995

Closed

Description

@PurHur

Category

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

Problem

str_pad() matches Zend on VM, but AOT returns the input unmodified (padding ignored). Prior AOT segfault (#23911) was closed; current symptom is silent wrong output.

Repro Zend / VM (2026-08-02, 79a0e27de) AOT after bin/compile.php
str_pad(\"a\", 5, \".\") a.... a

Reflection-only sibling: #25045 (not this AOT behavior gap).

php-src reference

PHP implementation target

  • AOT/JIT path for str_pad in ext/standard + lib/JIT — PHP-in-PHP; pad length / pad_string assembly under thin standalone Runtime
  • Re-verify three-arg and STR_PAD_* variants; no new C in runtime/

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/aot_str_pad.php <<'"'"'PHP'"'"'
<?php
echo str_pad("a", 5, "."), "\n";
PHP
echo -n "zend="; php /tmp/aot_str_pad.php
echo -n "vm="; php bin/vm.php /tmp/aot_str_pad.php 2>/dev/null
php bin/compile.php -o /tmp/aot_str_pad /tmp/aot_str_pad.php && /tmp/aot_str_pad
'

Done when

  • AOT binary prints a.... matching Zend/VM
  • Prefer --repeat 10 on the built binary before claiming fixed
  • Compliance or test/repro/ guard
  • php-src-strict; no php-compiler-strict shortcut

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 2, 2026
  2. PurHur commented on Aug 6, 2026

    @PurHur
    OwnerAuthor

    claim: Lane B implementer (Composer) — starting this run

    Mandatory pre-triage (this workspace):

    • docker info: ok
    • php script/bootstrap-inventory.php --check: OK 7109/7109
    • php script/check-selfhost-spine-coverage-sync.php: FAILED — 5 inventory files missing from spine (ext/imap/VmImapMutf7.php + 4 imap utf7/mutf7 helpers). Pillar 1 / north-star5-fast red until spine sync.
    • ./script/release-readiness.sh --json: user_release_ready: no (first related fail: north-star5-fast → spine coverage sync)
    • gen0_provenance: fresh; vm-driver-probe / gen0-driver-functional: ok

    Claiming #26995 (Lane B, area:compiler AOT wrong-output — not Reflection stub / not ext-owner lane). Will verify AOT str_pad("a", 5, ".") → a.... with --repeat 10.

  3. PurHur commented on Aug 6, 2026

    @PurHur
    OwnerAuthor

    Repro on current master (2115b36cad): already green — not the 2026-08-02 a wrong-output.

    zend=a....
    vm=a....
    aot=a....
    

    Also STR_PAD_LEFT / STR_PAD_BOTH / default pad, variable args, PHP_COMPILER_HELPER_RUNTIME_O=0, and --repeat 10 all match. Existing AOT fixtures str_pad.phpt + str_pad_literal_segfault.phpt pass.

    Shipping a #26995-tagged guard (exact issue one-liner) and closing via PR — root cause was already addressed by the inline StrPadJitHelper path (#23911 / #23931); this filing was a silent-wrong-output recheck that now holds.

  4. PurHur commented on Aug 6, 2026

    @PurHur
    OwnerAuthor

    Closed — already fixed on master (verified this run on 2115b36cad).

    Issue repro:

    zend=a....
    vm=a....
    aot=a....
    

    --repeat 10 all a....; also STR_PAD_*, variable pad_string, and PHP_COMPILER_HELPER_RUNTIME_O=0.

    Root path: inline StrPadJitHelper / __compiler_str_pad (#23911 / #23931). Existing AOT guards test/fixtures/aot/cases/str_pad.phpt and str_pad_literal_segfault.phpt already cover three-arg padding.

    Lane B next: claiming #27031 (AOT http_build_query segfault — confirmed red).

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