mirror of
https://github.com/php/php-src.git
synced 2024-12-21 16:00:18 +08:00
c39147d136
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
42 lines
742 B
PHP
42 lines
742 B
PHP
--TEST--
|
|
Bug #68652 (segmentation fault in destructor)
|
|
--FILE--
|
|
<?php
|
|
class Foo {
|
|
|
|
private static $instance;
|
|
public static function getInstance() {
|
|
if (isset(self::$instance)) {
|
|
return self::$instance;
|
|
}
|
|
return self::$instance = new self();
|
|
}
|
|
|
|
public function __destruct() {
|
|
Bar::getInstance();
|
|
}
|
|
}
|
|
|
|
class Bar {
|
|
|
|
private static $instance;
|
|
public static function getInstance() {
|
|
if (isset(self::$instance)) {
|
|
return self::$instance;
|
|
}
|
|
return self::$instance = new self();
|
|
}
|
|
|
|
public function __destruct() {
|
|
if (!isset(self::$instance)) return;
|
|
Foo::getInstance();
|
|
}
|
|
}
|
|
|
|
|
|
$foo = new Foo();
|
|
?>
|
|
OK
|
|
--EXPECT--
|
|
OK
|