Skip to content

$this->m[$k] += $arr on a property whose default is a nested array literal reads the element as int and prints an address #194

Closed

Description

@blacktrs

Summary

$this->m[$k] += $arr on a property whose default is a nested array literal reads the element as int and prints an address.

Repro

<?php
class B
{
    public array $m = ['F' => ['a' => 1]];

    public function t(string $e, array $p): void
    {
        $this->m[$e] += $p;
        echo json_encode($this->m), "\n";
    }
}
(new B())->t('F', ['c' => 3]);

Expected (php)

{"F":{"a":1,"c":3}}

Actual (manticore 2fe0c506, Darwin arm64)

{"F":4336130088}

Tracking

Known-bug repro: tests/aot/repro/wrong/compound_union_on_property_element_nested_default.php — bash tests/aot/xfail.sh -k compound_union_on_property_element_nested_default 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
    wrong-answer
    on Oct 11, 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

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions