Skip to content

A by-ref parameter reached through a spread of an array passed by reference does not write back #511

Closed

Description

@blacktrs

Summary

A by-ref parameter reached through a spread of an array passed by reference does not write back.

Repro

<?php
class A { public function inc(&$x) { $x = $x + 1; return $x; } }
function direct(A $o, array &$args) { return $o->inc(...$args); }
function dynamic(object $o, string $m, array &$args) { return $o->$m(...$args); }
$a = [10]; echo direct(new A, $a), " ", $a[0], "\n";
$b = [10]; echo dynamic(new A, "inc", $b), " ", $b[0], "\n";

Expected (php)

11 11
11 11

Actual (manticore 7e858577, Darwin arm64)

11 10
11 10

Tracking

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

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