Skip to content

ReflectionProperty::setValue() on a property of a prelude class (Exception::$message, ::$code) throws "Cannot write property" #289

Closed

Description

@blacktrs

Summary

ReflectionProperty::setValue() on a property of a prelude class (Exception::$message, ::$code) throws "Cannot write property".

Repro

<?php
$e = new RuntimeException('before');
$p = new ReflectionProperty('Exception', 'message');
$p->setValue($e, 'after');
echo $e->getMessage(), "\n";
(new ReflectionClass('Exception'))->getProperty('code')->setValue($e, 42);
echo $e->getCode(), "\n";

Expected (php)

after
42

Actual (manticore cc15d276, Darwin arm64)


[exit code 255]
PHP Fatal error:  Uncaught ReflectionException: Cannot write property message

Tracking

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