xref: /PHP-8.0/Zend/tests/bug72594.phpt (revision 9ed2f489)
1--TEST--
2Bug #72594 (Calling an earlier instance of an included anonymous class fatals)
3--FILE--
4<?php
5if (isset($runtime)) {
6    return new class {
7        public $bar;
8        public function bing($foo = null) {
9            if ($foo) $foo->bing();
10        }
11    };
12}
13
14$runtime = 1;
15$oldFoo = require(__FILE__);
16$newFoo = require(__FILE__);
17
18var_dump(get_class_methods($oldFoo));
19var_dump(get_object_vars($oldFoo));
20
21$newFoo->bing($oldFoo);
22?>
23--EXPECT--
24array(1) {
25  [0]=>
26  string(4) "bing"
27}
28array(1) {
29  ["bar"]=>
30  NULL
31}
32