Skip to content

$this->arr += $other followed by $this->arr[$k] += $v on a property array segfaults (symfony's EnvPlaceholderParameterBag::mergeEnvPlaceholders) #191

Closed

Description

@blacktrs

Summary

$this->arr += $other followed by $this->arr[$k] += $v on a property array segfaults (symfony's EnvPlaceholderParameterBag::mergeEnvPlaceholders).

Repro

<?php
class Bag
{
    private array $m = [];

    public function add(string $env, string $p): void
    {
        $this->m[$env][$p] = $p;
    }

    public function all(): array
    {
        return $this->m;
    }

    public function merge(self $bag): void
    {
        if ($new = $bag->all()) {
            $this->m += $new;

            foreach ($new as $env => $placeholders) {
                $this->m[$env] += $placeholders;
            }
        }
    }
}

$a = new Bag();
$a->add('FOO', 'p1');
$b = new Bag();
$b->add('FOO', 'p2');
$b->add('BAZ', 'p3');
$a->merge($b);
echo json_encode($a->all()), "\n";

Expected (php)

{"FOO":{"p1":"p1","p2":"p2"},"BAZ":{"p3":"p3"}}

Actual (manticore 25811c88, Darwin arm64)

{"FOO":2,"BAZ":2}

Tracking

Known-bug repro: tests/aot/repro/crash/compound_union_assign_on_property_array_element.php — bash tests/aot/xfail.sh -k compound_union_assign_on_property_array_element 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 11, 2026
  2. added a commit that references this issue on Oct 14, 2026
    320b47f
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