Skip to content

after array_shift, $q = null does not destroy the remaining objects until exit #315

Closed

Description

@blacktrs

Summary

after array_shift, $q = null does not destroy the remaining objects until exit.

Repro

<?php
class D { public function __construct(public string $n) {} public function __destruct() { echo "~", $this->n, " "; } }
function objs(): void
{
    $q = [new D('a'), new D('b')];
    array_shift($q);
    $q = null;
    echo "end\n";
}
objs();

Expected (php)

~a ~b end

Actual (manticore 6df3b897, Darwin arm64)

~a end
~b 

Tracking

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