Warning: substr() expects parameter 1 to be string, object given in /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php on line 1218
the part of call stack:
Exception: Warning: substr() expects parameter 1 to be string, object given in /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php on line 1218 in /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'substr() expect...', '/var/www/prod.s...', 1218, Array)
#1 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(1218): substr(Object(Credis_Client), 2, 3)
#2 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(467): Cm_Cache_Backend_Redis->_decodeData(Object(Credis_Client))
#3 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache/Core.php(306): Cm_Cache_Backend_Redis->load('b59_TRANSLATE_P...', false)
#4 /var/www/html/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(55): Zend_Cache_Core->load('b59_TRANSLATE_P...')
We noticed this line Cm_Cache_Backend_Redis->_decodeData(Object(Credis_Client))
The question:
In this method \Cm_Cache_Backend_Redis::load
The construction $this->_redis->hGet(self::PREFIX_KEY.$id, self::FIELD_DATA);
can return something else than bool|string ?
In signature we see this
maybe it's better to change if expression like this?
if ($data === NULL || is_object($data)) {
return FALSE;
}
Sometimes we randomly get errors like this
the part of call stack:
We noticed this line
Cm_Cache_Backend_Redis->_decodeData(Object(Credis_Client))
The question: In this method
\Cm_Cache_Backend_Redis::load
The construction$this->_redis->hGet(self::PREFIX_KEY.$id, self::FIELD_DATA);
can return something else thanbool|string
?In signature we see this![Selection_415](https://user-images.githubusercontent.com/3192770/75543889-1b80c300-5a23-11ea-9286-38892bb4e053.png)
maybe it's better to change if expression like this?
the app may not expect to get an object