1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/gh13531.phpt
Niels Dossche 8494058a1f Fix GH-13531: Unable to resize SplfixedArray after being unserialized in PHP 8.2.15
When unserializing, the cached_resize field was not reset to -1
correctly, causing the setSize() method to think we were inside of a
resize operation.

Closes GH-13543.
2024-02-27 23:04:23 +01:00

29 lines
418 B
PHP

--TEST--
GH-13531 (Unable to resize SplfixedArray after being unserialized in PHP 8.2.15)
--FILE--
<?php
$array = new SplFixedArray(5);
$array[4] = 1;
$serialized = serialize($array);
$unserialized = unserialize($serialized);
$unserialized->setSize(6);
var_dump($unserialized);
?>
--EXPECT--
object(SplFixedArray)#2 (6) {
[0]=>
NULL
[1]=>
NULL
[2]=>
NULL
[3]=>
NULL
[4]=>
int(1)
[5]=>
NULL
}