Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error in WP-CLI when accessing cache #410

Closed
jazzsequence opened this issue May 10, 2023 · 3 comments · Fixed by #422
Closed

Fatal error in WP-CLI when accessing cache #410

jazzsequence opened this issue May 10, 2023 · 3 comments · Fixed by #422

Comments

@jazzsequence
Copy link
Contributor

Since 1.4.0, WP Redis will generate a fatal error when cache functions are accessed from WP-CLI (possibly from runtime as well). This issue does not exist in 1.3.5 (the last 1.3.x release).

Steps to reproduce

  1. wp plugin install wp-redis --activate
  2. wp redis enable
  3. wp redis flush or wp cache flush

Result:

PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /app/wp-content/plugins/wp-redis/object-cache.php:139
Stack trace:
#0 /app/wp-includes/option.php(165): wp_cache_get('notoptions', 'options')
#1 /app/wp-includes/formatting.php(1107): get_option('blog_charset')
#2 /app/wp-includes/formatting.php(4577): wp_check_invalid_utf8('WP Redis: Conne...')
#3 /app/wp-content/plugins/wp-redis/object-cache.php(1471): esc_html('WP Redis: Conne...')
#4 /app/wp-content/plugins/wp-redis/object-cache.php(1185): WP_Object_Cache->_exception_handler(Object(RedisException))
#5 /app/wp-content/plugins/wp-redis/object-cache.php(1510): WP_Object_Cache->_connect_redis()
#6 /app/wp-content/plugins/wp-redis/object-cache.php(215): WP_Object_Cache->__construct()
#7 /app/wp-includes/load.php(750): wp_cache_init()
#8 /app/wp-settings.php(131): wp_start_object_cache()
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1336): require('/app/wp-setting...')
#10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1254): WP_CLI\Runner->load_wordpress()
#11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#14 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('phar:///usr/loc...')
#15 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#16 {main}
  thrown in /app/wp-content/plugins/wp-redis/object-cache.php on line 139
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.                                                                                                                          

Tracked internally in CMSP-390

@spacedmonkey
Copy link
Contributor

@pwtyler
Copy link
Member

pwtyler commented May 11, 2023

Unable to reproduce this on my local machine when Redis is not enabled (my working assumption up until now), see WIP script in #415.

This exits gracefully with

Error: Warning! PHPRedis extension is unavailable, which is required by WP Redis object cache.

EDIT: #418 clarified I needed to be one step further and now reproducing.

@pwtyler
Copy link
Member

pwtyler commented May 15, 2023

This is fixed in 1.4.2, now live on .org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants