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 Resources
can'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)
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:
new SplFileInfo('index.php');
$link=mysql_connect('localhost','root','');
echo $link;
The output is: Resource id #2
If you run this:
//new SplFileInfo('index.php');
$link=mysql_connect('localhost','root','');
echo $link;
The output is: Resource id #1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With