]> granicus.if.org Git - php/commitdiff
The test scripts bug64720.phpt and bug68652.phpt were relying on the buggy behavior,
authorJim Zubov <jim@commercebyte.com>
Tue, 7 Feb 2017 14:19:16 +0000 (09:19 -0500)
committerJim Zubov <jim@commercebyte.com>
Tue, 7 Feb 2017 14:19:16 +0000 (09:19 -0500)
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

Zend/tests/bug64720.phpt
Zend/tests/bug68652.phpt
Zend/tests/bug74053.phpt [new file with mode: 0644]

index 45dee3e8c46b4c7039ff47d6cb68ff153645f373..35b01e6a162909becff596365156cb8984c22c6b 100644 (file)
@@ -45,8 +45,3 @@ $bar = new Bar();
 $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
index 8e54af2e3485840942b6cef2028638fe709b4325..f0c9d5e9aa1f0f52a1c9da4ca29bd5ca8c1cf321 100644 (file)
@@ -37,10 +37,3 @@ class Bar {
 $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
-
diff --git a/Zend/tests/bug74053.phpt b/Zend/tests/bug74053.phpt
new file mode 100644 (file)
index 0000000..e8fc02d
--- /dev/null
@@ -0,0 +1,43 @@
+--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