Skip to content

A by-ref variadic fed by a plain argument AND a spread (put($b, ...$rest)) loses the writes to the spread part. #444

Closed

Description

@blacktrs

Summary

A by-ref variadic fed by a plain argument AND a spread (put($b, ...$rest)) loses the writes to the spread part.

Repro

<?php
function put(&...$x) { foreach ($x as $i => &$v) { $v = "p$i"; } }
$b = 1; $rest = [2, 3];
put($b, ...$rest);
var_dump($b, $rest);

Expected (php)

string(2) "p0"
array(2) {
  [0]=>
  string(2) "p1"
  [1]=>
  string(2) "p2"
}

Actual (manticore 9722da87, Darwin arm64)

string(2) "p0"
array(2) {
  [0]=>
  int(2)
  [1]=>
  int(3)
}

Tracking

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