Closed Jurigag closed 3 years ago
As a workaround for now i just override set/get methods and saved other value for this empty values and then return correct one if someone other had similar issue.
DId you try to specify server config?
$options = [
'defaultSerializer' => 'Json',
'lifetime' => 7200,
'servers' => [
0 => [
'host' => '10.4.13.100',
'port' => 11211,
'weight' => 1,
],
],
];
Yes, when saving 1 or 2 or any other value(basically non empty value) it works correctly @Jeckerson
I use Phalcon 4.0.6 and also is the same problem. I use cache with file and cache with APCu. In cache file is correct write value "false" in file on the disk, error is in method "get()".
It is problem:
// phalcon/Storage/Adapter/AbstractAdapter.zep
protected function getUnserializedData(var content, var defaultValue = null) -> var
{
// HERE IS PROBLEM
if !content {
return defaultValue;
}
// .....
}
https://github.com/phalcon/cphalcon/blob/master/phalcon/Storage/Adapter/AbstractAdapter.zep line 208
Why save empty value cache when it can be just removed?
Empty value such FALSE, 0, '0', [] is normal value.
Exactly empty value is normal value. Honestly I am not sure if code above is issue, but will check it later.
Resolved in https://github.com/phalcon/cphalcon/pull/15350
Describe the bug When using libmemcached for cache adapter and saving empty array or false or 0 and then getting a key null is returned instead of empty array/0/false.
To Reproduce
Steps to reproduce the behavior:
Expected behavior Return empty array instead of null
Details