From 9692150c2399242c57a2f3fcb9ac0abd1c5dd626 Mon Sep 17 00:00:00 2001 From: Miguel Dantas Date: Thu, 26 Sep 2019 11:23:02 +0100 Subject: [PATCH] Fix 'Call to a member function getPayload() on null' Trying to enable the RedisCache with the latest nightly, getting this with the daemon: sep 25 11:40:18 friedrich startdaemons.sh[21428]: PHP Fatal error: Uncaught Error: Call to a member function getPayload() on null in /var/www/social/plugins/RedisCache/RedisCachePlugin.php:96 sep 25 11:40:18 friedrich startdaemons.sh[21428]: Stack trace: sep 25 11:40:18 friedrich startdaemons.sh[21428]: #0 /var/www/social/lib/util/event.php(89): RedisCachePlugin->onStartCacheSet('gnusocial:herds...', Object(HubSub), NULL, 86400, false) sep 25 11:40:18 friedrich startdaemons.sh[21428]: #1 /var/www/social/lib/cache/cache.php(202): Event::handle('StartCacheSet', Array) sep 25 11:40:18 friedrich startdaemons.sh[21428]: #2 /var/www/social/classes/Memcached_DataObject.php(520): Cache->set('gnusocial:herds...', Object(HubSub)) sep 25 11:40:18 friedrich startdaemons.sh[21428]: #3 /var/www/social/classes/Memcached_DataObject.php(52): Memcached_DataObject->encache() sep 25 11:40:18 friedrich startdaemons.sh[21428]: #4 /var/www/social/classes/Managed_DataObject.php(50): Memcached_DataObject::getClassKV('HubSub', 'hashkey', 'a38b9dc516371af...') sep 25 11:40:18 friedrich startdaemons.sh[21428]: #5 /var/www/social/plugins/OStatus/classes/HubSub.php(47): Managed_DataObject::getKV('hashkey', 'a38b9dc516371af...') sep 25 11:40:18 friedrich startdaemons.sh[21428]: #6 /var/www/social/plugins/OStatus/lib/hubprepqueuehandler.php(68): HubSub::getByHashkey('https://herds.e...', 'https://raki.so...') sep 25 11:40:18 friedrich startdaemons.sh[21428]: #7 /var/www/social/plugins/RedisQueue/classes/RedisQueueManager.php(58): HubPrepQueueHandl in /var/www/social/plugins/RedisCache/RedisCachePlugin.php on line 96 Sign in to j --- 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 f2284dd8cd..072295a2f6 100644 --- a/plugins/RedisCache/RedisCachePlugin.php +++ b/plugins/RedisCache/RedisCachePlugin.php @@ -93,7 +93,7 @@ class RedisCachePlugin extends Plugin return true; } - if (is_int($ret) || $ret->getPayload() === "OK") { + if (is_int($ret) || (!is_null($ret) && $ret->getPayload() === "OK")) { $success = true; return false; }