Skip to content

ReflectionMethod::invokeArgs on __construct of a newInstanceWithoutConstructor() object does not run the promoted constructor #570

Closed

Description

@blacktrs

Summary

ReflectionMethod::invokeArgs on __construct of a newInstanceWithoutConstructor() object does not run the promoted constructor.

Repro

<?php
class K { public function __construct(public int $a = 0, public string $b = "") { } }
$o = (new ReflectionClass("K"))->newInstanceWithoutConstructor();
(new ReflectionMethod($o, "__construct"))->invokeArgs($o, [2, "y"]);
echo $o->a, $o->b, "\n";

Expected (php)

2y

Actual (manticore 08011355, Darwin arm64)

0

Tracking

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