when PHP returns "Undefined static property" error due to class entry corruption.
With my fix for bug 74053, both tests return no errors now, I corrected the EXPECTF accordingly
[Anybody please advice if I'm wrong?]
Also created bug74053.phpt, for the code I mentioned in the bug description
$bar->test();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Access to undeclared static property: Stat::$requests in %sbug64720.php:12
-Stack trace:
-#0 [internal function]: Stat->__destruct()
-#1 {main}
- thrown in %sbug64720.php on line 12
$foo = new Foo();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Access to undeclared static property: Bar::$instance in %sbug68652.php:%d
-Stack trace:
-#0 %s(%d): Bar::getInstance()
-#1 [internal function]: Foo->__destruct()
-#2 {main}
- thrown in %sbug68652.php on line %d
-
--- /dev/null
+--TEST--
+Bug #74053 (Corrupted class entries on shutdown when a destructor spawns another object)
+--FILE--
+<?php
+class b {
+ function __destruct() {
+ echo "b::destruct\n";
+ }
+}
+class a {
+ static $b;
+ static $new;
+ static $max = 10;
+ function __destruct() {
+ if (self::$max-- <= 0) return;
+ echo "a::destruct\n";
+ self::$b = new b;
+ self::$new[] = new a;
+ }
+}
+new a;
+?>
+--EXPECTF--
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct
+a::destruct
+b::destruct