-
Notifications
You must be signed in to change notification settings - Fork 74
Wordpress cached data unserialized as string instead of array after switching redis-cache-pro from standard serializer to igbinary #376
Description
lighttpd 1.4.69, PHP-fpm 8.2.3, debian 11, 10.5.18-MariaDB, redis-cache-pro - compression lz4
All packages are installed via apt
php info
igbinary support - enabled igbinary version 3.2.13
redis - Available serializers php, json, igbinary
session - Registered serializer handlers php_serialize php php_binary igbinary msgpack
session.serialize_handler igbinary igbinary
php -i | grep igbinary
/etc/php/8.2/cli/conf.d/20-igbinary.ini,
igbinary
igbinary support => enabled
igbinary version => 3.2.13
igbinary APCu serializer ABI => 0
igbinary session support => yes
igbinary.compact_strings => On => On
igbinary support => yes
Available serializers => php, json, igbinary
Registered serializer handlers => php_serialize php php_binary igbinary msgpack
session.serialize_handler => igbinary => igbinary
If you use php as the default serializer in the configuration, then everything works very quickly. But I read that igbinary_serialize works several times faster?
define( 'WP_REDIS_CONFIG', [ 'token' => '', 'host' => '127.0.0.1', 'port' => 6379, 'database' => 5, 'maxttl' => 3600 * 24 * 7, 'timeout' => 0.5, 'read_timeout' => 0.5, 'retry_interval' => 10, 'retries' => 3, //'serializer' => 'igbinary', 'compression' => 'lz4', 'async_flush' => true, 'client' => 'phpredis', 'split_alloptions' => true, 'shared' => true, 'prefetch' => true, 'debug' => false, 'save_commands' => false, ]); define('WP_REDIS_DISABLED', getenv('WP_REDIS_DISABLED') ?: false);
But when I turn on 'serializer' = > 'igbinary', in the config, I get a critical error in Wordpress.
2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:PHP message: PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, string given in /www/free/wp-includes/class-wp-roles.php:291 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:Stack trace: 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#0 /www/free/wp-includes/class-wp-roles.php(291): array_keys() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#1 /www/free/wp-includes/class-wp-roles.php(332): WP_Roles->init_roles() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#2 /www/free/wp-includes/class-wp-roles.php(91): WP_Roles->for_site() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#3 /www/free/wp-settings.php(542): WP_Roles->__construct() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#4 /www/free/wp-config.php(101): require_once('...') 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#5 /www/free/wp-load.php(50): require_once('...') 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#6 /www/free/wp-admin/admin-post.php(19): require_once('...') 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#7 {main} 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr: thrown in /www/free/wp-includes/class-wp-roles.php on line 291; PHP message: PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, string given in /www/free/wp-includes/class-wp-roles.php:291 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:Stack trace: 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#0 /www/free/wp-includes/class-wp-roles.php(291): array_keys() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#1 /www/free/wp-includes/class-wp-roles.php(332): WP_Roles->init_roles() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#2 /www/free/wp-includes/class-wp-roles.php(91): WP_Roles->for_site() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#3 /www/free/wp-includes/capabilities.php(997): WP_Roles->__construct() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#4 /www/free/wp-includes/class-wp-user.php(510): wp_roles() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#5 /www/free/wp-includes/class-wp-user.php(877): WP_User->get_role_caps() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#6 /www/free/wp-includes/class-wp-user.php(178): WP_User->for_site() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#7 /www/free/wp-includes/pluggable.php(109): WP_User->init() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#8 /www/free/wp-includes/pluggable.php(737): get_user_by() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#9 /www/free/wp-includes/class-wp-hook.php(308): wp_validate_auth_cookie() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#10 /www/free/wp-includes/plugin.php(205): WP_Hook->apply_filters() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#11 /www/free/wp-includes/user.php(3604): apply_filters() 2023-03-08 21:09:47: (mod_fastcgi.c.449) FastCGI-stderr:#12 /www/free/wp-includes/p... 2023-03-08 21:09:49: (mod_fastcgi.c.449) FastCGI-stderr:PHP message: PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, string given in /www/free/wp-includes/class-wp-roles.php:291