Skip to content

(array) $obj returns private and protected property keys unmangled instead of "\0Class\0name" / "\0*\0name" #239

Closed

Description

@blacktrs

Summary

(array) $obj returns private and protected property keys unmangled instead of "\0Class\0name" / "\0*\0name".

Repro

<?php
class A
{
    private $p = 1;
    protected $q = 2;
    public $r = 3;
}
class B extends A
{
    private $s = 4;
}
foreach ((array) new B() as $k => $v) {
    echo json_encode($k), '=', $v, "\n";
}
var_dump(array_key_exists("\0A\0p", (array) new A()));

Expected (php)

"\u0000A\u0000p"=1
"\u0000*\u0000q"=2
"r"=3
"\u0000B\u0000s"=4
bool(true)

Actual (manticore b31cd215, Darwin arm64)

"p"=1
"q"=2
"r"=3
"s"=4
bool(false)

Tracking

Known-bug repro: tests/aot/repro/wrong/array_cast_object_keys_not_mangled.php — bash tests/aot/xfail.sh -k array_cast_object_keys_not_mangled 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 13, 2026
  2. added 2 commits that reference this issue on Oct 14, 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