PHP Warning in class-beta-optin.php – Rank Math Plugin

#1008787
  • Resolved Korea Holik
    Rank Math free

    Hello Rank Math Support Team,

    I hope you’re doing well.

    I’m currently experiencing a PHP warning on my WordPress website related to the Rank Math plugin. The warning message is as follows:

    Warning: Trying to access array offset on value of type bool in /home/u117428023/domains/koreaholik.com/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/version-control/class-beta-optin.php on line 106

    Warning: Trying to access array offset on value of type bool in /home/u117428023/domains/koreaholik.com/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/version-control/class-beta-optin.php on line 145

    This error appears at the top of my website pages and seems to be triggered by the plugin. I’m currently using the latest version of WordPress and Rank Math.

    Could you please advise on how to resolve this issue? I’d also appreciate any temporary workaround while waiting for a permanent fix.

    Thank you for your support!

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    We apologize for the issue you are facing with the PHP warning related to the Rank Math plugin. This warning typically indicates that there is an attempt to access an array offset on a boolean value, which can occur due to various reasons, including plugin conflicts or issues in the code.

    Here are a few steps you can take to troubleshoot and potentially resolve this issue:

    1. Update Plugins and Themes: Ensure that all your plugins and themes are updated to their latest versions. Sometimes, compatibility issues can cause such warnings.

    2. Check for Plugin Conflicts: Deactivate all other plugins except Rank Math and see if the warning persists. If it resolves, reactivate each plugin one by one to identify the conflicting plugin.

    3. Switch Themes: Temporarily switch to a default WordPress theme (like Twenty Twenty-One) to check if the issue is theme-related.

    4. Debugging: If you’re comfortable with debugging, you can check the lines mentioned in the warning (lines 106 and 145 in class-beta-optin.php) to see what values are being accessed and why they might be boolean instead of an array.

    5. Contact Support: If the issue persists after trying the above steps, please reply to this ticket with your site URL so that a human agent from our support team can assist you further.

    Thank you for bringing this to our attention, and we appreciate your patience as we work to resolve this issue!

    Sources:
    This Plugin Does Not Work with Your Version of PHP » Rank Math

    Hello,

    Thank you for contacting Rank Math support.

    We apologise for the inconvenience this issue must have caused you.

    We have shared this with our developers. We will get back to you once we have an update or solution from them.

    Thank you so much for your patience while we resolve this for you.

    Hello,

    Our team has already identified the cause. A fix for this will be included in the next plugin update.

    We would also like to share all the technical details of this issue and what exactly is failing.

    Our entire team and the developers checked this in detail, and it looks like the issue is with the WordPress HTTP API on WPEngine, not the WP.org API endpoint.

    The endpoint https://api.wordpress.org/plugins/info/1.0/seo-by-rank-math.json does return the full data, including the versions field, but only when the request bypasses WordPress HTTP API.

    That call is done on the file seo-by-rank-math\includes\modules\version-control\class-version-control.php on the function get_plugin_info();

    To confirm this, we tested the following different ways to call the API:

    wp_remote_get(): No versions field (Currently used by our plugin)
    plugins_api(): No versions field
    file_get_contents(): Full response including versions

    So, it does seem like something in WPEngine’s environment (likely a proxy, firewall, or modified cURL config) is interfering with or truncating HTTP API responses.

    What we noticed is that when we make that call from websites hosted on WP Engine, the last piece of the data from the response, which includes the versions of the plugin, is not available. That is only available when we use the function file_get_contents().

    Using file_get_contents() works because it entirely avoids the WordPress HTTP wrapper.

    To test this on the website, you can output the results of the following calls to the logs and see the difference:

    
    $missing_versions_key = wp_remote_get('https://api.wordpress.org/plugins/info/1.0/seo-by-rank-math.json');
    $has_versions_key = file_get_contents('https://api.wordpress.org/plugins/info/1.0/seo-by-rank-math.json');
    

    This should be able to be confirmed by the WP Engine teamif you pass this information along to them.

    Rest assured that we are working on a permanent fix for this matter, but we thought it would be beneficial to also share the information with WP Engine since we only see this happening on servers hosted there at the moment.

    Don’t hesitate to get in touch if you have any other questions.

    Hello,

    We released a quick Beta update you can try to see if that helps.

    Please enable the Beta update by following this:
    https://rankmath.com/kb/version-control/#beta-updates

    beta update

    If you are unable to see an update, please clear Rank Math’s transients from:
    WP Dashboard > Rank Math > Status & Tools > Database Tools > Remove Rank Math Transients > Remove transients
    remove transients rank math

    Please clear the caches, server, and WordPress after updating.

    You can disable the Beta updates once you update to the latest version and if the issue is fixed.

    We are here to assist. Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘PHP Warning in class-beta-optin.php – Rank Math Plugin’ is closed to new replies.