You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to resize SplfixedArray after being unserialized in PHP 8.2.15 #13531
<?phpini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('error_reporting', E_ALL);
echo"============" . "<br />";
echo"Testing in " . phpversion() . "<br />";
echo"============";
echo"<br /><br />";
/** * Create 5 items */$array = newSplFixedArray(5);
/** * Get size * EXPECTED: 5 */$size = $array->getSize();
echo"Original size before serializing. Expected result is 5." . "<br />";
echo"Actual result: $size";
echo"<br /><br />";
/** * Serialize SPLFixedArray object */$serialized = serialize($array);
/** * Unserialize SPLFixedArray object */$array = unserialize($serialized);
/** * Get size * EXPECTED: 5 */$size = $array->getSize();
echo"Original size after serializing. Expected is still 5." . "<br />";
echo"Actual result is $size";
echo"<br /><br />";
/** * Resize SPLFixedArray to 6 items */echo"Resizing array to 6 items" . "<br />";
$array->setSize(6);
/** * Get size after resize * EXPECTED: 6 */$size = $array->getSize();
echo"Updated size after resize. " . "<em>" . "Expected is 6." . "</em>" . "<br />";
echo"<strong>" . "Actual result is $size" . "</strong>";
echo"<br />";
Resulted in this output:
============
Testing in 8.2.15
============
Original size before serializing. Expected result is 5.
Actual result: 5
Original size after serializing. Expected is still 5.
Actual result is 5
Resizing array to 6 items
Updated size after resize. Expected is 6.
Actual result is 5
But I expected this output instead:
============
Testing in 8.2.15
============
Original size before serializing. Expected result is 5.
Actual result: 5
Original size after serializing. Expected is still 5.
Actual result is 5
Resizing array to 6 items
Updated size after resize. Expected is 6.
Actual result is 6
Additional notes:
This is only reproducible with PHP 8.2.15.
It works well with PHP 8.1/8.0/7.4.
I've checked the docs on changes with setSize() method with PHP 8.2. It does not mention that it cannot be used after unserializing. So I open this ticket as it could be a bug. Thank you!
Activity
Fix phpGH-13531: Unable to resize SplfixedArray after being unseriali…
Fix GH-13531: Unable to resize SplfixedArray after being unserialized…
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'