I am using Doctrine Cache for my project and I am using it's PhpFileCache driver. https://github.com/doctrine/cache/blob/1.10.x/lib/Doctrine/Common/Cache/PhpFileCache.php
and I can't understand why it is not saving any of my data just in raw php array? instead it is save all of them like a serialised data with function to unserialise them. https://github.com/doctrine/cache/blob/1.10.x/lib/Doctrine/Common/Cache/PhpFileCache.php#L87-L93
if (is_object($data) && method_exists($data, '__set_state')) {
$value = var_export($value, true);
$code = sprintf('<?php return %s;', $value);
} else {
$value = var_export(serialize($value), true);
$code = sprintf('<?php return unserialize(%s);', $value);
}
I see. That there is some additional check here and all my data don't pass this condition for some reason, but if I will just leave this code:
$value = var_export($value, true);
$code = sprintf('<?php return %s;', $value);
it will save a raw php arrays in cache from all of my data and it is works.
Why this is happens? Why this condition do not works for me?