Skip to content

Regression: AOT base64_decode segfaults after build — encode OK (ext/standard/base64.c) #26890

Description

@PurHur

Category

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

Problem

AOT base64_encode matches Zend. AOT base64_decode builds then segfaults on master@bb3571d82 (2026-08-02). VM/JIT match Zend for both.

Repro Zend / VM / JIT AOT
base64_encode('hi') aGk= aGk=
base64_decode('aGk=') hi segfault (c:main_before_php)
encode then decode in one script aGk=|hi aGk=| then segfault

php-src reference

PHP implementation target

  • ext/standard Base64 JIT helper / AOT lowering for decode return boxing (encode path is the working reference)
  • PHP-in-PHP; no new C decode tables

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/b64.php << "PHP"
<?php
echo base64_decode("aGk="), "\n";
PHP
php bin/vm.php /tmp/b64.php
php bin/compile.php -o /tmp/b64.bin /tmp/b64.php && /tmp/b64.bin
'
# today: VM prints hi ; AOT segfaults

Done when

  • AOT base64_decode matches Zend/VM; encode stays green
  • Combined encode|decode script green
  • Compliance / test/repro/ guard; php-src-strict

Gate snapshot when filing (2026-08-02, bb3571d82)

  • inventory OK 6773/6773; north-star5-fast ok

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 2, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

    TRY_FIRST (host):

  3. PurHur commented on Aug 2, 2026

    @PurHur
    OwnerAuthor

    Merged via #26927

    Fix: Base64JitHelper NestedJIT-self-contained — append-only decode accumulator (no $str[$i]=, no negative bit cursor / VmString call). Peer #26868 / #20452.

    Verified (Docker, PHP_COMPILER_HELPER_RUNTIME_O=0):

    • Base64RuntimeShrinkTest OK (4/43)
    • VM/JIT/AOT test/repro/maintainer_gap_aot_base64_decode.php → hi / aGk=|hi; argv Zm9v → foo
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