xref: /PHP-8.2/Zend/tests/bug73816.phpt (revision 6f63e053)
1--TEST--
2Bug #73816: Broken eval(anonymous class)
3--FILE--
4<?php
5
6function anon()
7{
8    static $i = 0;
9    return eval(sprintf('return new class { private $prop%s; };', ++$i));
10}
11
12var_dump(anon());
13var_dump(anon());
14
15?>
16--EXPECT--
17object(class@anonymous)#1 (1) {
18  ["prop1":"class@anonymous":private]=>
19  NULL
20}
21object(class@anonymous)#1 (1) {
22  ["prop2":"class@anonymous":private]=>
23  NULL
24}
25