mirror of
https://github.com/php/php-src.git
synced 2024-12-01 05:43:38 +08:00
86434be946
nNumOfElements was incremented after the pDestructor code, so any code in the dtor would get a wrong number of elements. Right now the bucket deletion code is replicated in four places, it should probably be moved off into one function (or rather, zend_hash_apply_deleter should be used everywhere). The codes are subtly different though in that the HANDLE_UNBLOCK_INTERRUPTIONS() happens in different places. In particular it seems odd that in some cases interruptions stay blocked during the destructor call.
24 lines
333 B
PHP
24 lines
333 B
PHP
--TEST--
|
|
Bug #65051: count() off by one inside unset()
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
public $array;
|
|
|
|
public function __destruct() {
|
|
var_dump(count($this->array[0]));
|
|
var_dump($this->array[0]);
|
|
}
|
|
}
|
|
|
|
$array = [[new Foo]];
|
|
$array[0][0]->array =& $array;
|
|
unset($array[0][0]);
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(0)
|
|
array(0) {
|
|
}
|