[OFFER ALERT!] This Halloween, Get Any Premium Theme for Just $19 [GET IT NOW]
Jump to content

[Rank Math SEO Plugin] Invalid argument supplied for foreach() in /wp-content/plugins/seo-by-rank-math/includes/class-replace-vars.php on line 876


ventas4
 Share

Recommended Posts

Hello, i'm getting this error on PHP log:

PHP Warning: Invalid argument supplied for foreach() in /wp-content/plugins/seo-by-rank-math/includes/class-replace-vars.php on line 876

This is what that line says:

            // Custom Fields.
            $json          = array();
            $custom_fields = get_post_custom( $post->ID );
876            foreach ( $custom_fields as $custom_field_name => $custom_field ) {
                if ( substr( $custom_field_name, 0, 1 ) === '_' ) {
                    continue;
                }

                $json[ $custom_field_name ] = $custom_field[0];
            }
            Helper::add_json( 'customFields', $json );
        }

 

PHP version is 7.2

 

How to fix it?

Link to comment
Share on other sites

  • Support

Hello @ventas

On 2/26/2019 at 11:53 PM, ventas4 said:

Thank you for your fast support

If dev team needs further access to debug, let me know

This issue has been addressed in the latest update of the plugin. Please update your plugin to v1.0.18.

Hope that helps. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello,

Thank you for contacting MyThemeShop and sorry for any inconvenience that might have been caused due to that.

Please share your login details and page URL in the "Sensitive Data" section by clicking the Add button on the top and bottom right-hand side on this ticket and follow the instructions shown in the screenshot below:
rQoczm+

Looking forward to helping you. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello,

I logged into your site but I don't see any warnings or errors in Dashboard and in Settings. Can you please give us a page link where you get the error?

Looking forward to helping you. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello,

The error you see on your site is in the foreach loop which gets the lists of custom fields registered for the particular posts. It's strange you are getting that error. For now, to fix it on your site I added a condition before the foreach loop to check if the variable is empty in the plugin file /wp-content/plugins/seo-by-rank-math/includes/class-replace-vars.php on line 876.

I forwarded this issue to our Development team, they will further debug this and provide a fix in the next update of the plugin.

Hope that helps. Please let us know if there is anything else.

Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

i also have same issue of php errors in my website, https://www.ngospelmedia.net

 

[24-Feb-2019 15:23:55 UTC] PHP Warning:  preg_match_all(): Compilation failed: range out of order in character class at offset 81 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[24-Feb-2019 15:24:14 UTC] PHP Warning:  preg_match_all(): Compilation failed: range out of order in character class at offset 81 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[24-Feb-2019 16:21:15 UTC] PHP Warning:  preg_match_all(): Compilation failed: missing ) at offset 77 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[24-Feb-2019 20:40:43 UTC] PHP Warning:  preg_match_all(): Compilation failed: missing ) at offset 77 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[25-Feb-2019 00:27:07 UTC] PHP Warning:  preg_match_all(): Compilation failed: unmatched parentheses at offset 67 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[26-Feb-2019 02:19:39 UTC] PHP Warning:  preg_match_all(): Compilation failed: missing terminating ] for character class at offset 82 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[26-Feb-2019 02:19:44 UTC] PHP Warning:  preg_match_all(): Compilation failed: missing terminating ] for character class at offset 82 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[26-Feb-2019 08:07:03 UTC] PHP Warning:  preg_match_all(): Compilation failed: range out of order in character class at offset 81 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[26-Feb-2019 13:07:07 UTC] PHP Warning:  preg_match_all(): Compilation failed: range out of order in character class at offset 81 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394
[26-Feb-2019 15:35:30 UTC] PHP Warning:  preg_match_all(): Compilation failed: missing ) at offset 77 in /home/********/public_html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-generate.php on line 394

 

There are more in my server errorlog.php, i just copied these ones to show you people... thanks...

Edited by nobility4christ2008
Link to comment
Share on other sites

  • Support

Hello @ventas

On 2/26/2019 at 11:53 PM, ventas4 said:

Thank you for your fast support

If dev team needs further access to debug, let me know

This issue has been addressed in the latest update of the plugin. Please update your plugin to v1.0.18.

Hope that helps. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello @nobility4christ2008

Sorry for the issue you are facing. To avoid confusion, please create a new support ticket. Our Support team will assist you there.

Looking forward to helping you. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello,

It was a pleasure helping you. We are glad you found our help useful. If you have any other questions in future, do let us know. We are here to help you.

Could you please leave us a testimonial (if you haven't already done that) on about your overall experience with MyThemeShop? This will help us serve you, our members, better. We appreciate your time and patience.

https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?filter=5

Thank you in anticipation.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Mili locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...