Skip to content

A typed or dynamically-called property passed by reference to a storing callee is stored as a stale copy. #353

Open

Description

@blacktrs

Summary

A typed or dynamically-called property passed by reference to a storing callee is stored as a stale copy.

Repro

<?php
class H { public array $r = []; function keep(mixed &$v) { $this->r[] = &$v; } }
class O { public int $x = 1; public $q = 1; }
$h = new H; $o = new O; $h->keep($o->x); $o->x = 2; echo $h->r[0], "\n";
$h2 = new H; $m = 'keep'; $h2->$m($o->q); $o->q = 3; echo $h2->r[0], "\n";
$h3 = new H; $n = 'q'; $f = $h3->keep(...); $f($o->$n); $o->q = 4; echo $h3->r[0], "\n";

Expected (php)

2
3
4

Actual (manticore 868c12ed, Darwin arm64)

1
1
3

Tracking

Known-bug repro: tests/aot/repro/wrong/ref_store_property_arg_dynamic.php — bash tests/aot/xfail.sh -k ref_store_property_arg_dynamic reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

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

    bugneeds-designwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions