If `memberful_error_log` option is empty, new logs aren’t stored, PHP8 fatals
-
If the
memberful_error_log
is deleted or contains an empty string, the error logs are not stored. In PHP 7.4, a warning is logged:Warning: array_slice() expects parameter 1 to be array, string given in /srv/htdocs/wp-content/plugins/memberful-wp/src/api.php on line 172
Warning: array_unshift() expects parameter 1 to be array, null given in /srv/htdocs/wp-content/plugins/memberful-wp/src/api.php on line 174In any PHP 8 version, a fatal error occurs:
Fatal error: Uncaught TypeError: array_slice(): Argument #1 ($array) must be of type array, string given in /srv/htdocs/wp-content/plugins/memberful-wp/src/api.php:172
Stack trace:
#0 /srv/htdocs/wp-content/plugins/memberful-wp/src/api.php(172): array_slice('', 0, 99, true)
#1 phar:///usr/local/bin/wp-cli/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php(46) : eval()'d code(1): memberful_wp_store_error(Array)
#2 phar:///usr/local/bin/wp-cli/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php(46): eval()
#3 phar:///usr/local/bin/wp-cli/vendor/wp-cli/shell-command/src/Shell_Command.php(52): WP_CLI\Shell\REPL->start()
#4 [internal function]: Shell_Command->__invoke(Array, Array)
#5 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func(Array, Array, Array)
#6 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#7 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func(Object(Closure), Array, Array)
#8 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#9 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(464): WP_CLI\Runner->run_command(Array, Array)
#10 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1295): WP_CLI\Runner->run_command_and_exit()
#11 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#12 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#13 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#14 phar:///usr/local/bin/wp-cli/php/boot-phar.php(20): include('phar:///usr/loc...')
#15 /usr/local/bin/wp-cli(4): include('phar:///usr/loc...')
#16 {main}
thrown in /srv/htdocs/wp-content/plugins/memberful-wp/src/api.php on line 172In either case, the log is not stored in the option. We were able to work around it by adding this code to a plugin/theme on the site:
function mysite_memberful_error_log_option_as_array( $value ) {
return is_array( $value ) ? $value : array();
}
add_filter( 'option_memberful_error_log', 'mysite_memberful_error_log_option_as_array' );This should be fixed in the plugin, though.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.