mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
Fixed bug #32799 (crash: calling the corresponding global var during the destruct)
This commit is contained in:
parent
e5d3e07862
commit
ce23692663
21
Zend/tests/bug32799.phpt
Executable file
21
Zend/tests/bug32799.phpt
Executable file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #32799 (crash: calling the corresponding global var during the destruct)
|
||||
--FILE--
|
||||
<?php
|
||||
class test{
|
||||
public $c=1;
|
||||
function __destruct (){
|
||||
$GLOBALS['p']->c++; // no warning
|
||||
print $GLOBALS['p']->c."\n"; // segfault
|
||||
var_dump($GLOBALS['p']);
|
||||
}
|
||||
}
|
||||
$p=new test;
|
||||
$p=null; //destroy the object by a new assignment (segfault)
|
||||
?>
|
||||
--EXPECT--
|
||||
2
|
||||
object(test)#1 (1) {
|
||||
["c"]=>
|
||||
int(2)
|
||||
}
|
@ -151,7 +151,9 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
|
||||
EG(objects_store).object_buckets[handle].destructor_called = 1;
|
||||
|
||||
if (obj->dtor) {
|
||||
zobject->refcount++;
|
||||
obj->dtor(obj->object, handle TSRMLS_CC);
|
||||
zobject->refcount--;
|
||||
}
|
||||
}
|
||||
if (obj->refcount == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user