Skip to content

Assigning a mixed value of the wrong type to a typed property throws a TypeError with a generic message instead of php's #291

Closed

Description

@blacktrs

Summary

Assigning a mixed value of the wrong type to a typed property throws a TypeError with a generic message instead of php's.

Repro

<?php
class A { public int $p = 1; }
function f(A $a, mixed $v) { $a->p = $v; }
try { f(new A, 'abc'); } catch (TypeError $e) { echo $e->getMessage(), "\n"; }

Expected (php)

Cannot assign string to property A::$p of type int

Actual (manticore 7b0f6e2d, Darwin arm64)

Argument must be of type int, string given

Tracking

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