Description
The following code:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$array = new SplFixedArray(5);
$array[1] = 2;
$array[2] = "test value";
$copy = $array;
$serialized_one = serialize($array);
$object_vars = get_object_vars($array);
foreach ($object_vars as $property_name => $property_value) {
$copy[$property_name] = $property_value;
}
$serialized_two = '';
if ($copy === $array) {
$serialized_two = serialize($copy);
}
if ($serialized_one === $serialized_two) {
echo "PHP version " . phpversion() . " is ok";
}
Resulted in this output:
500 internal server error or no output
But I expected this output instead:
Notes:
- The above test code works in all commonly active versions: PHP 8.1, PHP 8.0 and PHP 7.4. However the above code does not work only in PHP 8.2.4.
- Originally reproduced with Ubuntu 20.04 + PHP 8.2.4.
- This is also reproducible in PHP Windows environment using PHP 8.2.4 .
I've check the upgrade notes on PHP 8.2.4. There is nothing that mention between serialize() and SplFixedArray. I'm still learning more about PHP 8.2, so please help me confirm if this is a bug or simply a usage issue. Thank you!
PHP Version
PHP 8.2.4
Operating System
Ubuntu 20.04 / Windows 10
Description
The following code:
Resulted in this output:
But I expected this output instead:
Notes:
I've check the upgrade notes on PHP 8.2.4. There is nothing that mention between
serialize()andSplFixedArray. I'm still learning more about PHP 8.2, so please help me confirm if this is a bug or simply a usage issue. Thank you!PHP Version
PHP 8.2.4
Operating System
Ubuntu 20.04 / Windows 10