Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--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 | ||
} |