Skip to content

A class with a promoted constructor property lists that property before the declared ones in get_object_vars(). #302

Closed

Description

@blacktrs

Summary

A class with a promoted constructor property lists that property before the declared ones in get_object_vars().

Repro

<?php
class Row { public $a; public $b; public function __construct(public string $tag = 'none') {} }
echo json_encode(get_object_vars(new Row('T'))), "\n";
$r = new Row; $r->a = 1; echo json_encode(array_keys(get_object_vars($r))), "\n";

Expected (php)

{"a":null,"b":null,"tag":"T"}
["a","b","tag"]

Actual (manticore e1d451af, Darwin arm64)

{"tag":"T","a":null,"b":null}
["tag","a","b"]

Tracking

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