Skip to content

A temporary passed as an argument is destroyed after the callee's locals, so destruct order and reused object ids differ from php. #557

Open

Description

@blacktrs

Summary

A temporary passed as an argument is destroyed after the callee's locals, so destruct order and reused object ids differ from php.

Repro

<?php
final class O { public function __construct(public int $i) {} public function __destruct() { echo "d{$this->i}\n"; } }
/** @param O[] $objs */
function first(array $objs): void { $v = $objs[0]; echo spl_object_id($v), "\n"; }
first([new O(7), new O(1)]);
echo spl_object_id(new O(3)), "\n";

Expected (php)

1
d1
d7
d3
1

Actual (manticore 8ef23f14, Darwin arm64)

1
d7
d1
d3
2

Tracking

Known-bug repro: tests/aot/repro/wrong/temp_arg_destroyed_after_callee_locals.php — bash tests/aot/xfail.sh -k temp_arg_destroyed_after_callee_locals 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 Nov 2, 2026
  2. added 2 commits that reference this issue on Nov 2, 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