Closed josenobile closed 3 years ago
Hi @josenobile
Thank you for reporting this issue. We have found what's causing it, and the fix for it will be included in the next update for Rank Math.
The issue is happening because there was a breaking change in PHP 8:
Removed ability to call non-static methods statically. Thus is_callable will fail when checking for a non-static method with a classname (must check with an object instance).
For future reference, to fix this issue all you need to change is one line: https://github.com/rankmath/seo-by-rank-math/blob/cd0df1fae4c474dc9954a82799a5b5a6e631baed/includes/cli/class-commands.php#L31
Just need to add the static
keyword:
public static function sitemap_generate( $args ) {
After doing this, WP-CLI should work correctly. Hope that helps.
It fails with a PHP fatal error when calling from wp-cli
Callable ["\\RankMath\\CLI\\Commands","sitemap_generate"] does not exist, and cannot be registered as
wp rankmath sitemap generate.
To Reproduce Steps to reproduce the behavior:
curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -s --output /usr/local/bin/wp && chmod +x /usr/local/bin/wp
wp cron event run --due-now --path=/home/user/whereWordpressIsInstalled
Expected behavior The command runs with an exit code = 0 and an output similar to what in PHP 7.4.14 is gotten:
Additional context WP-CLI 2.4.0 WordPress version: 5.6 PHP 8.0.1 (cli) (built: Jan 8 2021 10:09:55) ( NTS gcc x86_64 ) mysql Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1 Linux ... 4.18.0-147.8.1.el7h.lve.1.x86_64 #1 SMP Mon Jun 29 09:05:02 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux Database revision: 49752 TinyMCE version: 4.9110 (49110-20201110) Package language: es_ES