xref: /PHP-8.1/Zend/tests/bug65051.phpt (revision 86434be9)
1--TEST--
2Bug #65051: count() off by one inside unset()
3--FILE--
4<?php
5
6class Foo {
7    public $array;
8
9    public function __destruct() {
10        var_dump(count($this->array[0]));
11        var_dump($this->array[0]);
12    }
13}
14
15$array = [[new Foo]];
16$array[0][0]->array =& $array;
17unset($array[0][0]);
18
19?>
20--EXPECT--
21int(0)
22array(0) {
23}
24