rhubarbgroup / redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
https://wordpress.org/plugins/redis-cache/
GNU General Public License v3.0
428 stars 149 forks source link

Argument #2 ($array) must be of type array in object-cache.php:1491 #414

Closed tillkruss closed 1 year ago

tillkruss commented 1 year ago
#0 /var/www/html/wp-content/object-cache.php(1491): array_map()
#1 /var/www/html/wp-content/object-cache.php(1453): WP_Object_Cache->delete_multiple_at_once()
#2 /var/www/html/wp-content/object-cache.php(137): WP_Object_Cache->delete_multiple()
#3 /var/www/html/wp-includes/meta.php(503): wp_cache_delete_multiple()
#4 /var/www/html/wp-includes/post.php(6427): delete_metadata()
#5 /var/www/html/wp-content/themes/minima/functions.php(1131): wp_delete_attachment()
#6 /var/www/html/wp-includes/class-wp-hook.php(310): apply_action_before_delete_post()
#7 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()

Also

thrown in ../public_html/wp-content/object-cache.php on line 1253

 PHP Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in /home/hil7kuh/public_html/wp-content/object-cache.php:1253 Stack trace

Stack trace:

#0 /home/hil7kuh/public_html/wp-content/object-cache.php(1253): array_map()
#1 /home/hil7kuh/publi_html/wp-content/object-cache.php(1178): WP_Object_Cache->add_multiple_at_once()
#2 /home/hil7kuh/public_html/wp-content/object-cache.php(79): WP_Object_Cache->add_multiple()
#3 /home/hil7kuh/public_html/wp-includes/post.php(7358): wp_cache_add_multiple()
#4 /home/hil7kuh/public_html/wp-includes/post.php(7438): update_post_cache()
#5 /home/hil7kuh/public_html/wp-includes/post.php(7895): update_post_caches()
#6 /home/hil7kuh/public_html/wp-includes/class-wp-query.php(3479): _prime_post_caches()
#7 /home/hil7kuh/public_html/wp-includes/class-wp-query.php(3749): WP_Query->get_posts()
#8 /home/hil7kuh/public_html/wp-includes/post.php(2415): WP_Query->query()
#9 /home/hil7kuh/public_html/wp-content/themes/woodmart/inc/theme-setup.php(303): get_posts()
#10 /home/hil7kuh/public_html/wp-includes/class-wp-hook.php(308): woodmart_widget_init()
#11 /home/hil7kuh/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#12 /home/hil7kuh/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#13 /home/hil7kuh/public_html/wp-includes/widgets.php(1854): do_action()
#14 /home/hil7kuh/public_html/wp-includes/class-wp-hook.php(308): wp_widgets_init()
#15 /home/hil7kuh/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#16 /home/hil7kuh/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#17 /home/hil7kuh/public_html/wp-settings.php(617): do_action()
#18 /home/hil7kuh/public_html/wp-config.php(115): require_once('/home/hil7kuh/p...')
#19 /home/hil7kuh/public_html/wp-load.php(50): require_once('/home/hil7kuh/p...')
#20 /home/hil7kuh/public_html/wp-cron.php(46): require_once('/home/hil7kuh/p...')
#21 {main}

  thrown in /home/hil7kuh/public_html/wp-content/object-cache.php on line 1253
tillkruss commented 1 year ago

@A5hleyRich wanna take a look at this one?

tillkruss commented 1 year ago

@A5hleyRich It's add_multiple_at_once() and delete_multiple_at_once() being called. Can you try calling them with [null, false, 1, -10] and other terrible keys?

A5hleyRich commented 1 year ago

@tillkruss no dice. I've tried passing various data through add_multiple_at_once() and `delete_multiple_at_once() but I can't get this error to happen.

tillkruss commented 1 year ago

I think we can just switch the operator from ?? to ?: for all call pipeline calls:

https://github.com/rhubarbgroup/redis-cache/blob/9f44fee1508a5cf449eb35dba46b513d3a3103d2/includes/object-cache.php#L1253