-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Unable to serialize processed SplFixedArrays in PHP 8.2.4 #10907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can confirm your findings: Does indeed not reproduce on 8.1, but does on 8.2. |
…8.2.4 The properties table can also contain numeric entries after a rebuild of the table based on the array. Since the array can only contain numeric entries, and the properties table can contain a mix of both, we'll add the numeric entries from the array and only the string entries from the properties table. To implement this we simply check if the key from the properties table is a string.
I fixed this particular issue in this commit on my fork: nielsdos@042287c However, the test won't pass yet because I ran into another pre-existing issue... The numeric-like string bug is not an actual problem for this issue I think. I just wanted to test that scenario in my .phpt file to see if I didn't break anything wrt that. I see that @Girgias is listed as code owner, maybe you can help here (if you want) :) ? |
Erg this feels like something related to this change in 7.2: https://www.php.net/manual/en/migration72.incompatible.php#migration72.incompatible.object-array-casts So I think it is expected behaviour? Looking at the code run on all versions, the behaviour seems consistent since mid PHP 5.4 The fix looks sensible tho |
Strange but okay. I'll not touch that behaviour and just amend my test and then create a PR for this. Thanks for having a look. |
…8.2.4 The properties table can also contain numeric entries after a rebuild of the table based on the array. Since the array can only contain numeric entries, and the properties table can contain a mix of both, we'll add the numeric entries from the array and only the string entries from the properties table. To implement this we simply check if the key from the properties table is a string.
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
The text was updated successfully, but these errors were encountered: