Skip to content

An element write $m[0] = 9 on a mixed value holding an ArrayAccess object crashes (SIGBUS) instead of calling offsetSet #95

Closed

Description

@blacktrs

Summary

An element write $m[0] = 9 on a mixed value holding an ArrayAccess object crashes (SIGBUS) instead of calling offsetSet.

Repro

<?php
final class A implements ArrayAccess {
    /** @var array<int, int> */
    private array $d = [0, 0, 0];
    public function offsetExists(mixed $o): bool { return isset($this->d[$o]); }
    public function offsetGet(mixed $o): mixed { return $this->d[$o]; }
    public function offsetSet(mixed $o, mixed $v): void { $this->d[$o] = (int)$v; }
    public function offsetUnset(mixed $o): void { $this->d[$o] = 0; }
}
function pick(): mixed { return new A(); }
$r = pick();
$r[0] = 9;
echo $r[0], "\n";

Expected (php)

9

Actual (manticore c7b1d623, Darwin arm64)


[exit code 139 — SIGSEGV]

Tracking

Known-bug repro: tests/aot/repro/crash/erased_arrayaccess_element_write.php — bash tests/aot/xfail.sh -k erased_arrayaccess_element_write 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 5, 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