I’m trying to store an array of SplFileInfo instances in a cache with serialize command but the command throws this exception:
Exception' with message 'Serialization of 'SplFileInfo' is not allowed
Why is it not allowed?
Thanks!
Note: I’m just curious. The problem itself can be worked around.
Objects based on
Resourcescan’t be serialized.I guess I don’t have to explain why (if you need the explanation tell me even if it’s OT in this question)
Addendum
For @Charles that doesn’t believe that SplFileInfo doens’t store/open a new resource I have made a little test script.
If you run this:
The output is: Resource id #2
If you run this:
The output is: Resource id #1.