xref: /PHP-8.4/Zend/tests/gh16725.phpt (revision 048fa7ba)
1--TEST--
2GH-16725: Incorrect access check for non-hooked props in hooked object iterator
3--FILE--
4<?php
5
6class C implements JsonSerializable
7{
8    private string $prop1 { get => 'bar'; }
9
10    public function __construct(
11        private string $prop2,
12    ) {}
13
14    public function jsonSerialize(): mixed {
15        return get_object_vars($this);
16    }
17}
18
19$obj = new C('foo');
20var_dump(get_object_vars($obj));
21echo json_encode($obj);
22
23?>
24--EXPECT--
25array(0) {
26}
27{"prop1":"bar","prop2":"foo"}
28