mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Merge branch 'PHP-5.5'
* PHP-5.5: Fixed bug #64720 (SegFault on zend_deactivate) Conflicts: NEWS
This commit is contained in:
commit
bf146ad5b5
48
Zend/tests/bug64720.phpt
Normal file
48
Zend/tests/bug64720.phpt
Normal file
@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Bug #64720 (SegFault on zend_deactivate)
|
||||
--FILE--
|
||||
<?php
|
||||
class Stat {
|
||||
private static $requests;
|
||||
public static function getInstance() {
|
||||
if (!isset(self::$requests[1])) {
|
||||
self::$requests[1] = new self();
|
||||
}
|
||||
return self::$requests[1];
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
unset(self::$requests[1]);
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
public function __construct() {
|
||||
Stat::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
class Error {
|
||||
private $trace;
|
||||
public function __construct() {
|
||||
$this->trace = debug_backtrace(1);
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
public function __destruct() {
|
||||
Stat::getInstance();
|
||||
new Error();
|
||||
}
|
||||
|
||||
public function test() {
|
||||
new Error();
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Foo();
|
||||
$bar = new Bar();
|
||||
$bar->test();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access to undeclared static property: Stat::$requests in %sbug64720.php on line 12
|
@ -1281,6 +1281,14 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p
|
||||
}
|
||||
}
|
||||
|
||||
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL) ||
|
||||
UNEXPECTED(CE_STATIC_MEMBERS(ce)[property_info->offset] == NULL)) {
|
||||
if (!silent) {
|
||||
zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &CE_STATIC_MEMBERS(ce)[property_info->offset];
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -166,8 +166,9 @@ static inline void cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
|
||||
|
||||
for (i = 0; i < ce->default_static_members_count; i++) {
|
||||
if (ce->static_members_table[i]) {
|
||||
zval_ptr_dtor(&ce->static_members_table[i]);
|
||||
zval *p = ce->static_members_table[i];
|
||||
ce->static_members_table[i] = NULL;
|
||||
zval_ptr_dtor(&p);
|
||||
}
|
||||
}
|
||||
ce->static_members_table = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user