MDL-63127 cachestore_redis: add check before using igbinary_serialize

Redis::SERIALIZER_IGBINARY is undefined if redis is not compiled
with this option.
This commit is contained in:
Mark Nelson 2019-09-14 19:53:24 +02:00
parent 54a659a5bd
commit 3ad56eee9f

View File

@ -649,7 +649,7 @@ class cachestore_redis extends cache_store implements cache_is_key_aware, cache_
return $value;
case Redis::SERIALIZER_PHP:
return serialize($value);
case Redis::SERIALIZER_IGBINARY:
case defined('Redis::SERIALIZER_IGBINARY') && Redis::SERIALIZER_IGBINARY:
return igbinary_serialize($value);
default:
debugging("Invalid serializer: {$this->serializer}");
@ -669,7 +669,7 @@ class cachestore_redis extends cache_store implements cache_is_key_aware, cache_
return $value;
case Redis::SERIALIZER_PHP:
return unserialize($value);
case Redis::SERIALIZER_IGBINARY:
case defined('Redis::SERIALIZER_IGBINARY') && Redis::SERIALIZER_IGBINARY:
return igbinary_unserialize($value);
default:
debugging("Invalid serializer: {$this->serializer}");