Skip to content

Assigning a non-array to an array property is a TypeError; the store is accepted silently. #579

Closed

Description

@blacktrs

Summary

Assigning a non-array to an array property is a TypeError; the store is accepted silently.

Repro

<?php
class O { public array $p = []; }
$o = new O; $v = 5;
try { $o->p = $v; echo "no error\n"; } catch (TypeError $e) { echo $e->getMessage(), "\n"; }
function m(): mixed { return 5; }
try { $o->p = m(); echo "no error\n"; } catch (TypeError $e) { echo $e->getMessage(), "\n"; }

Expected (php)

Cannot assign int to property O::$p of type array
Cannot assign int to property O::$p of type array

Actual (manticore db1fc3b4, Darwin arm64)

no error
no error

Tracking

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