From 5e166063583e343ea31484096a7cdb71e96326e3 Mon Sep 17 00:00:00 2001 From: Miguel Dantas Date: Mon, 2 Sep 2019 16:49:46 +0100 Subject: [PATCH] [RedisCache] Fix call to getPayload on int. The library is badly documented, but seems to return the TTL instead of the normal redis response Issue description as reported by aab: About one day after enabling redis plugin: PHP Fatal error: Uncaught Error: Call to a member function getPayload() on int in /var/www/html/plugins/RedisCache/RedisCachePlugin.php:96 Stack trace: 0 /var/www/html/lib/event.php(89): RedisCachePlugin->onStartCacheSet('gnusocial:gatea...', Object(Queue_item), NULL, 86400, false) 1 /var/www/html/lib/cache.php(202): Event::handle('StartCacheSet', Array) 2 /var/www/html/classes/Memcached_DataObject.php(496): Cache->set('gnusocial:gatea...', Object(Queue_item)) 3 /var/www/html/classes/Memcached_DataObject.php(416): Memcached_DataObject->encache() 4 /var/www/html/classes/Managed_DataObject.php(620): Memcached_DataObject->update(Object(Queue_item)) 5 /var/www/html/classes/Queue_item.php(74): Managed_DataObject->update(Object(Queue_item)) 6 /var/www/html/lib/dbqueuemanager.php(75): Queue_item::top(Array, Array) 7 /var/www/html/lib/iomaster.php(287): DBQueueManager->poll() 8 /var/www/html/lib/iomaster.php(161): IoMaster->poll() 9 /var/www/html/scripts/queuedaemon.php(112): IoMaster->service() 10 /var/www/html/lib/spawni in /var/www/html/plugins/RedisCache/RedisCachePlugin.php on line 96 --- plugins/RedisCache/RedisCachePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/RedisCache/RedisCachePlugin.php b/plugins/RedisCache/RedisCachePlugin.php index 8d4bfa98ac..f2284dd8cd 100644 --- a/plugins/RedisCache/RedisCachePlugin.php +++ b/plugins/RedisCache/RedisCachePlugin.php @@ -93,7 +93,7 @@ class RedisCachePlugin extends Plugin return true; } - if ($ret->getPayload() === "OK") { + if (is_int($ret) || $ret->getPayload() === "OK") { $success = true; return false; }