Merge branch 'master' of github.com:commercebyte/php-src
* 'master' of github.com:commercebyte/php-src:
Added EG(flags) - executor global flags EG_FLAGS_IN_SHUTDOWN - is set when PHP is in shutdown state
newly added zend_object_store.no_reuse is redefined as a global zend_object_store_no_reuse, to avoid alignment issues
Alignment fix, as per @nikic
The test scripts bug64720.phpt and bug68652.phpt were relying on the buggy behavior, 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
Bug Fix: Corrupted class entries on shutdown when a destructor spawns another object (C) 2017 CommerceByte Consulting
. Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester)
. Fixed bug #73987 (Method compatibility check looks to original
definition and not parent). (pmmaga)
++ . Fixed bug #74053 (Corrupted class entries on shutdown when a destructor
++ spawns another object). (jim at commercebyte dot com)
- BCMath:
. Fixed bug #46564 (bcmod truncates fractionals). (liborm85)
$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
++OK
++--EXPECT--
++OK
$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
-
++OK
++--EXPECT--
++OK
--- /dev/null
---EXPECTF--
+ --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;
+ ?>
++--EXPECT--
+ 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
void php_request_shutdown(void *dummy)
{
zend_bool report_memleaks;
-
+
+ EG(flags) |= EG_FLAGS_IN_SHUTDOWN;
+
report_memleaks = PG(report_memleaks);
/* EG(current_execute_data) points into nirvana and therefore cannot be safely accessed