|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75268 SplFixedArray doesn't implement __set_state().
Submitted: 2017-09-27 15:07 UTC Modified: 2023-01-15 16:49 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: brad at hallnet dot co dot uk Assigned:
Status: Verified Package: SPL related
PHP Version: 7.0.23 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: brad at hallnet dot co dot uk
New email:
PHP Version: OS:


 [2017-09-27 15:07 UTC] brad at hallnet dot co dot uk
The SplFixedArray implementation doesn't have a __set_state() function, and as such var_export() creates code which does not function. 

Test script:

Expected result:
The SplFixedArray can be exported and the code functions correctly.

Actual result:
Syntax error in exported code.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-13 20:43 UTC] carusogabriel34 at gmail dot com
Couldn't reproduce
 [2018-02-13 21:07 UTC]
-Type: Bug +Type: Feature/Change Request
 [2018-02-13 21:07 UTC]
@carusogabriel34: The code generation works, but running the code doesn't, as SplFixedArray does not implement __set_state():
 [2020-10-01 04:10 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: levim
 [2020-10-01 04:54 UTC]
I'm trying to implement this for Hacktoberfest.
 [2020-10-01 16:49 UTC]
Here's an example that shows existing serialization/unserialization is not quite correct:

My plan to fix this is to have string keys become properties and for numeric keys to become array values. This same design should work for __set_state.
 [2020-10-02 03:03 UTC]
The following pull request has been associated:

Patch Name: Add SplFixedArray::__set_state
On GitHub:
 [2023-01-15 16:49 UTC]
-Status: Assigned +Status: Open -Assigned To: levim +Assigned To:
 [2023-01-15 16:49 UTC]
I wasn't able to complete it in the time I allotted. I hope dynamic properties will probably be forbidden on this class at some point in the future, which will help alleviate if not totally fix the issue.
 [2023-01-15 16:49 UTC]
-Status: Open +Status: Verified
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 20:01:31 2024 UTC