rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
107 stars 52 forks source link

Broken PHP in Plugin Update #194

Closed revans-premier-education closed 1 year ago

revans-premier-education commented 1 year ago

What's going on guys? This is the second time a plugin release/update has contained a core PHP syntax error, taking down our entire site completely. I've had to disable auto-updates now.

Issue is in class-taxonomy.php where the fourth param ($tax_name) has a trailing slash within the do_filter method call.

Parse error: syntax error, unexpected ')' in /home/XXXX/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/providers/class-taxonomy.php on line 150

$item = $this->do_filter(
        'sitemap/index/entry',
        [
                'loc'     => Router::get_base_url( $tax_name . '-sitemap' . $current_page . $
                'lastmod' => $query->have_posts() ? $query->posts[0]->post_modified_gmt : $l$
        ],
        'term',
        $tax_name,
);

Can you advise?

Many thanks in advanced.

Moustachey commented 1 year ago

Confirmed had this issue earlier today on a fresh local WP install. The same install worked on a slightly different install. Didn't work on: php-7.2.19-Win32-VC15-x64 Worked on: 8.1.2-1ubuntu2.14

I was able to resolve the issue by manually removing the unecessary comma in the plugin. I have since created a Pull Request to resolve this for any other users.

balazsrm commented 1 year ago

Hello @revans-premier-education & @Moustachey,

Thank you for reporting this issue, that was caused by a PHP 7.2 incompatibility issue in the code. We've been planning to increase the minimum PHP requirement to 7.3, and we made that step in version 1.0.202, so this issue is not relevant anymore. Please update your server to PHP version 7.3 or higher to keep using Rank Math.

Please note that even PHP 7.4 has reached its end of life and is not officially supported anymore. Recommended PHP version to use today is 8.2.