Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed bug #64720 (SegFault on zend_deactivate)

Conflicts:
	NEWS
This commit is contained in:
Dmitry Stogov 2013-05-21 10:33:57 +04:00
commit bf146ad5b5
3 changed files with 58 additions and 1 deletions

48
Zend/tests/bug64720.phpt Normal file
View 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

View File

@ -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];
}
/* }}} */

View File

@ -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;