Skip to content

Two references to the same by-ref param stored in one callee do not alias each other. #351

Closed

Description

@blacktrs

Summary

Two references to the same by-ref param stored in one callee do not alias each other.

Repro

<?php
class T { public array $r = []; function k(string &$v) { $this->r[] = &$v; $this->r[] = &$v; } }
$t = new T; $y = "a"; $t->k($y); $t->r[0] = "b"; echo $t->r[1], "\n";
class B { public array $r = []; function __construct(mixed &$v) { $this->r[] = &$v; $v = 2; echo $this->r[0], "\n"; } }
$x = 1; new B($x);

Expected (php)

b
2

Actual (manticore 868c12ed, Darwin arm64)

a
2

Tracking

Known-bug repro: tests/aot/repro/wrong/ref_store_twice_in_one_callee.php — bash tests/aot/xfail.sh -k ref_store_twice_in_one_callee 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 19, 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