Skip to content

Overwriting a dynamic property through a runtime name never releases the old value; releasing it needs a dynamic read to take its own count first. #592

Open

Description

@blacktrs

Summary

Overwriting a dynamic property through a runtime name never releases the old value; releasing it needs a dynamic read to take its own count first.

Repro

<?php
class H { public function __construct(public string $n) {} public function __destruct() { echo "drop {$this->n}\n"; } }
function t() { $o = new stdClass(); $k = 'a'; $o->$k = new H("first"); echo "set\n"; $o->$k = new H("second"); echo "over\n"; }
t();
echo "end\n";

Expected (php)

set
drop first
over
drop second
end

Actual (manticore 744fe188, Darwin arm64)

set
over
drop second
end
drop first

Tracking

Known-bug repro: tests/aot/repro/leak/dyn_prop_overwrite_keeps_old_value.php — bash tests/aot/xfail.sh -k dyn_prop_overwrite_keeps_old_value 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
    leak
    on Nov 7, 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

    bugleak

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions