You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The Igbinary serializer storage adapter is not saving bool and is_numeric() values, because of isSerializable() check at Phalcon\Storage\Serializer\Igbinary->serialize() function.
isSerializable() function checks for is_numeric/boolean in value that need to be saved and skips igbinary_serialize() for it. After that raw value fails to igbinary_unserialize() and cache->get() returns null.
POC
$apcCache = new \Phalcon\Cache\Adapter\Apcu(new \Phalcon\Storage\SerializerFactory(), [
'defaultSerializer' => 'Igbinary',
]);
$key = 'cache-key';
$val = '100';
$apcCache->set($key, $val, 10);
var_dump($val); // 100
var_dump($this->apcCache->get($key)); // null <------- SHOULD BE SAME VALUE
// Correct cache save/retrieve with non numeric string
$val = 'i_am_string';
$apcCache->set($key, $val, 10);
var_dump($val); // i_am_string
var_dump($this->apcCache->get($key)); // i_am_string <---- correct behavior
Solution
All values should be serialized with igbinary_serialize(). Remove isSerializable() check from Phalcon\Storage\Serializer\Igbinary->serialize() function.
Details
Phalcon version: 4.1.0
PHP Version: PHP 7.3
Zephir version (if any): No
The text was updated successfully, but these errors were encountered:
Jeckerson
added
5.0
The issues we want to solve in the 5.0 release
and removed
4.1.1
The issues we want to solve in the 4.1.1 release
labels
Mar 26, 2021
Describe the bug
The Igbinary serializer storage adapter is not saving
bool
andis_numeric()
values, because ofisSerializable()
check atPhalcon\Storage\Serializer\Igbinary->serialize()
function.cphalcon/phalcon/Storage/Serializer/Igbinary.zep
Line 20 in 3241d96
isSerializable() function checks for is_numeric/boolean in value that need to be saved and skips
igbinary_serialize()
for it. After that raw value fails toigbinary_unserialize()
andcache->get()
returns null.POC
Solution
All values should be serialized with
igbinary_serialize()
. RemoveisSerializable()
check fromPhalcon\Storage\Serializer\Igbinary->serialize()
function.Details
Phalcon version: 4.1.0
PHP Version: PHP 7.3
Zephir version (if any): No
The text was updated successfully, but these errors were encountered: