Skip to content

A property bound by reference to a new element appended to a nested array in another property ($this->data = &$this->data['child'][$k][];) is refused at emit. #613

Open

Description

@blacktrs

Summary

A property bound by reference to a new element appended to a nested array in another property ($this->data = &$this->data['child'][$k][];) is refused at emit.

Repro

<?php
class P {
    public $data = [];
    public $datas = [];
    public function open(string $ns, string $el): void {
        $this->datas[] = &$this->data;
        $this->data = &$this->data['child'][$ns][$el][];
        $this->data = ['name' => $el];
    }
    public function close(): void {
        $this->data = &$this->datas[count($this->datas) - 1];
        array_pop($this->datas);
    }
}
$p = new P();
$p->open('atom', 'feed');
$p->open('atom', 'title');
$p->close();
$p->close();
echo json_encode($p->data), "\n";

Expected (php)

{"child":{"atom":{"feed":[{"name":"feed","child":{"atom":{"title":[{"name":"title"}]}}}]}}}

Actual (manticore eb172eda, Darwin arm64)

compile failed (rc=65):
compile failed (emit): unsupported: cannot take a storable reference to this expression (array_access) — it has no address, so the reference would be a copy and every write through it would be lost (in P__open) (src/Compile/Mir/Passes/EmitLlvm.php:1026)
compile: front-end (parse/typeck/IR) returned null (rc=65)

Tracking

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