1--TEST-- 2SplFixedArray::setSize in offsetSet destructor (#81429) 3--FILE-- 4<?php 5$values = new SplFixedArray(1); 6$values->offsetSet(0, new HasDestructor()); 7$values->offsetSet(0, false); 8echo "Done\n"; 9 10class HasDestructor { 11 public function __destruct() { 12 global $values; 13 var_dump($values); 14 $values->setSize($values->getSize() - 1); 15 echo "After reducing size:\n"; 16 var_dump($values); 17 } 18} 19 20$values->setSize(5); 21$values->offsetSet(4, new HasDestructor()); 22echo "Done\n"; 23--EXPECT-- 24object(SplFixedArray)#1 (1) { 25 [0]=> 26 bool(false) 27} 28After reducing size: 29object(SplFixedArray)#1 (0) { 30} 31Done 32Done 33object(SplFixedArray)#1 (5) { 34 [0]=> 35 NULL 36 [1]=> 37 NULL 38 [2]=> 39 NULL 40 [3]=> 41 NULL 42 [4]=> 43 object(HasDestructor)#2 (0) { 44 } 45} 46After reducing size: 47object(SplFixedArray)#1 (4) { 48 [0]=> 49 NULL 50 [1]=> 51 NULL 52 [2]=> 53 NULL 54 [3]=> 55 NULL 56} 57