Skip to content

Overwriting an element of a declared string[] whose buffer holds boxed cells (sort() of numeric-like strings out of a docblock-typed array<string, string[]>) releases the NaN-boxed word and segfaults. #501

Closed

Description

@blacktrs

Summary

Overwriting an element of a declared string[] whose buffer holds boxed cells (sort() of numeric-like strings out of a docblock-typed array<string, string[]>) releases the NaN-boxed word and segfaults.

Repro

<?php
/** @return array<string, string[]> */
function grp(string $s): array
{
    $out = [];
    foreach (explode('|', $s) as $p) {
        $out[substr($p, -1)][] = $p;
    }
    return $out;
}
$cli = grp('3a|2b|1a|0a');
$theirs = $cli['a'];
sort($theirs);
echo implode(',', $theirs), ' ', implode(',', $cli['a']), "\n";
$more = $cli['b'];
$more[] = '9b';
rsort($more);
echo implode(',', $more), ' ', implode(',', $cli['b']), "\n";

Expected (php)

0a,1a,3a 3a,1a,0a
9b,2b 2b

Actual (manticore e8625a35, Darwin arm64)


[exit code 139 — SIGSEGV]

Tracking

Known-bug repro: tests/aot/repro/crash/elem_overwrite_boxed_string_slot.php — bash tests/aot/xfail.sh -k elem_overwrite_boxed_string_slot reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    crash
    on Oct 27, 2026
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

    bugcrash

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions