FATAL NOPERM if no Redis info permission
-
If the users have no Redis +info permission, the plugin fatals, taking down the WP. The easy fix is to check if the wp_object_cache is null:
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache;
if(is_null($wp_object_cache)) {
return false;
}
return $wp_object_cache->get( $key, $group, $force, $found );
}Predis\Response\ServerException: NOPERM User default has no permissions to run the 'info' command in wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php:416
Stack trace:
#0 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(385): Predis\Client->onErrorResponse()
#1 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(336): Predis\Client->executeCommand()
#2 wp-content/object-cache.php(1097): Predis\Client->__call()
#3 wp-content/object-cache.php(563): WP_Object_Cache->fetch_info()
#4 wp-content/object-cache.php(256): WP_Object_Cache->__construct()
#5 wp-includes/load.php(897): wp_cache_init()
#6 wp-settings.php(149): wp_start_object_cache()
#7 wp-config.php(376): require_once('/home1l/wordpre...')
#8 wp-load.php(50): require_once('/home1l/wordpre...')
#9 wp-blog-header.php(13): require_once('/home1l/wordpre...')
#10 index.php(17): require('/home1l/wordpre...')
#11 {main}
PHP Fatal error: Uncaught Error: Call to a member function get() on null in wp-content/object-cache.php:193
Stack trace:
#0 wp-includes/option.php(621): wp_cache_get()
#1 wp-includes/option.php(164): wp_load_alloptions()
#2 wp-includes/l10n.php(53): get_option()
#3 wp-includes/l10n.php(166): get_locale()
#4 wp-includes/l10n.php(798): determine_locale()
#5 wp-content/object-cache.php(2951): load_textdomain()
#6 wp-content/object-cache.php(2933): WP_Object_Cache->show_error_and_die()Also, if the redis goes offline or changes IP, the whole WP fatals — might want to add some try-catch safety
Predis\Connection\ConnectionException: php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://redisdelv.comp.uvic.ca:6379] in wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/AbstractConnection.php:144
Stack trace:
#0 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/StreamConnection.php(130): Predis\Connection\AbstractConnection->onConnectionError()
#1 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/StreamConnection.php(175): Predis\Connection\StreamConnection->createStreamSocket()
#2 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/StreamConnection.php(89): Predis\Connection\StreamConnection->tcpStreamInitializer()
#3 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/AbstractConnection.php(85): Predis\Connection\StreamConnection->createResource()
#4 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/StreamConnection.php(255): Predis\Connection\AbstractConnection->connect()
#5 wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(231): Predis\Connection\StreamConnection->connect()
#6 wp-content/object-cache.php(923): Predis\Client->connect()
#7 wp-content/object-cache.php(549): WP_Object_Cache->connect_using_predis()
#8 wp-content/object-cache.php(258): WP_Object_Cache->__construct()
#9 wp-includes/load.php(897): wp_cache_init()
#10 wp-settings.php(149): wp_start_object_cache()
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.