Skip to content

$obj->p = &$d copies instead of binding a reference #58

Closed

Description

@blacktrs

Summary

$obj->p = &$d copies instead of binding a reference.

Repro

<?php
final class O { public mixed $p = null; }
$o = new O();
$d = 1;
$o->p = &$d;
$d = 2;
echo $o->p, "\n";

Expected (php 8.5)

2

Actual (manticore 10affa68, macOS arm64)

1

Tracking

Known-bug repro: tests/aot/repro/wrong/prop_ref_assign.php — bash tests/aot/xfail.sh -k prop_ref_assign 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 5, 2026
  2. added
    needs-design
    area:refs
    on Oct 13, 2026
  3. blacktrs commented on Oct 13, 2026

    @blacktrs
    ContributorAuthor

    Scope: epic, not a lowering fix. A property slot must be able to hold a reference cell. The ref-cell design (docs/design/reference-cells.md) supports this only for array elements. Needs: slot representation for a ref-bound property, read/write/unset/clone/serialize/var_dump walkers aware of it. Tried in batch A: lowering alone cannot do it. Repro: tests/aot/repro/wrong/prop_ref_assign.php.

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

    area:refsbugneeds-designwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions