Skip to content

Reading an unset typed property through an erased receiver answers null instead of throwing. #594

Closed

Description

@blacktrs

Summary

Reading an unset typed property through an erased receiver answers null instead of throwing.

Repro

<?php
class P { public array $t; }
function mk(): object { return new P; }
$o = mk();
try { echo json_encode($o->t), "\n"; } catch (Error $e) { echo $e->getMessage(), "\n"; }

Expected (php)

Typed property P::$t must not be accessed before initialization

Actual (manticore 6922faba, Darwin arm64)

null

Tracking

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

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions