Sitemap throwing Fatal Error when “Include Images from the ACF Fields” is ON

#368106
  • Resolved Saumya Majumder
    Rank Math free

    Hi,
    it seems that the Rank Math is throwing a Fatal Error on some sitemaps like pages, posts etc. when the “Include Images from the ACF Fields” option is turned on in the Rank Math Sitemap General Settings.
    Please note that the site is using the latest version of ACF Pro and Rank Math.

    Here is the error that is thrown by Rank Math:

    Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math-pro/includes/modules/acf/class-acf.php:159 Stack trace: #0 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math-pro/includes/modules/acf/class-acf.php(90): RankMathProACFACF->get_sub_fields_content() #1 /some/path/sites/example.com/public/wp-includes/class-wp-hook.php(307): RankMathProACFACF->parse_html_images() #2 /some/path/sites/example.com/public/wp-includes/plugin.php(233): WP_Hook->apply_filters() #3 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/traits/class-hooker.php(102): apply_filters_ref_array() #4 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-image-parser.php(191): RankMathSitemapImage_Parser->do_filter() #5 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-image-parser.php(119): RankMathSitemapImage_Parser->get_post_images() #6 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/providers/class-post-type.php(447): RankMathSitemapImage_Parser->get_images() #7 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/providers/class-post-type.php(197): RankMathSitemapProvidersPost_Type->get_url() #8 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-generator.php(169): RankMathSitemapProvidersPost_Type->get_sitemap_links() #9 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-generator.php(135): RankMathSitemapGenerator->build_sitemap() #10 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(160): RankMathSitemapGenerator->get_output() #11 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(147): RankMathSitemapSitemap_XML->build_sitemap() #12 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(85): RankMathSitemapSitemap_XML->has_sitemap_in_cache() #13 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(75): RankMathSitemapSitemap_XML->output() #14 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-router.php(79): RankMathSitemapSitemap_XML->__construct() #15 /some/path/sites/example.com/public/wp-includes/class-wp-hook.php(307): RankMathSitemapRouter->request_sitemap() #16 /some/path/sites/example.com/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #17 /some/path/sites/example.com/public/wp-includes/plugin.php(522): WP_Hook->do_action() #18 /some/path/sites/example.com/public/wp-includes/class-wp-query.php(1103): do_action_ref_array() #19 /some/path/sites/example.com/public/wp-includes/class-wp-query.php(1791): WP_Query->parse_query() #20 /some/path/sites/example.com/public/wp-includes/class-wp-query.php(3542): WP_Query->get_posts() #21 /some/path/sites/example.com/public/wp-includes/class-wp.php(637): WP_Query->query() #22 /some/path/sites/example.com/public/wp-includes/class-wp.php(760): WP->query_posts() #23 /some/path/sites/example.com/public/wp-includes/functions.php(1310): WP->main() #24 /some/path/sites/example.com/public/wp-blog-header.php(16): wp() #25 /some/path/sites/example.com/public/index.php(17): require('...') #26 {main} thrown in /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math-pro/includes/modules/acf/class-acf.php on line 159

    I’ve also included a screen recording demonstration in the sensitive data section.

    Please note that this issue was present in the Rank Math code (Link: https://support.rankmath.com/ticket/fatal-error-warning-on-rank-math-while-viewing-sitemap/) which was fixed previously but it seems that issue is back again. So @pratik-d if you can look into this and resolve this little bug, it would be really helpful.

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

    Thanks for contacting us and sorry for any inconvenience that might have been caused due to that.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hi,
    As this is a very high-traffic website, unfortunately, I cannot provide any login at this point as I will have no idea of what changes you are making and if you guys are installing any plugins on the site and then deleting it. I hope you understand.

    But let me know which exact settings page you want to take a look at and I would be more than happy to share the respective screenshot and video recording.

    Hello,

    Can you please share the details about the ACF fields that you are using on your posts and pages to add the images so we can try to replicate the issue on our end?

    Looking forward to helping you.

    Thanks.

    Hi Jaideep,
    as per your request I have added a video demonstration of the ACF field groups in the sensitive data section.
    I’ve also added a temp login there as well. But do note that do not make any changes once you login. Do not enable/disable anything or add/remove any plugin without first informing me.

    Hello,

    Thanks for sharing the access and the screencast. The user you have created for us doesn’t have access to the Custom Fields settings. Can you please share the access so we can have a closer look? We will not change anything without your permission.

    Looking forward to helping you.

    Hi Jaideep,
    Custom Fields access has been given. Please check now.

    Hello,

    I see the issue on your site but I couldn’t reproduce it on my setup even after importing the data from your site. Can you please create a staging site or add your live site’s FTP access details in the Sensitive Data Section so we can debug this by editing some plugin files?

    Looking forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hi @pratik-d,
    I have added the FTP details as well, but please note that do not make any unusual changes on the data.
    Also note that the site is running a caching, so if you try doing var_dump() or something like that, make sure you need to disable the caching first.

    Though the sitemap pages are excluded from the caching anyways, so if you are var dumping there it won’t be any issue.

    Let me know and keep me posted on if and any changes that you make.

    Hello,

    Thank you for sharing the FTP access. I was able to fix the issue on your site by changing the following code on line 159 in seo-by-rank-math-pro/includes/modules/acf/class-acf.php file:

    Replaced:
    $content .= $value[ $layout['name'] ];

    With:
    $content .= is_array( $value ) && ! empty( $value[ $layout['name'] ] ) ? $value[ $layout['name'] ] : '';

    I have also logged it as a bug and we’ll make sure to include this fix in the next update.

    I hope that helps.

    Hi @pratik-d,
    Thanks for acknowledging this. Glad to see that you have figured out the bug. Looking forward to the future release with the fix in it.

    Anas
    Rank Math business

    Hello,

    We are super happy that your issue is resolved.

    If you have any questions in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

    Hello,

    Thank you for your patience.

    Just a quick update that we have fixed this issue on one of our recent releases.

    Please update Rank Math & all other plugins, themes and WordPress to the latest version.

    The issue should be fixed.

    If not, please feel free to open a support topic or reply to this message and we will be more than happy to assist.

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

The ticket ‘Sitemap throwing Fatal Error when “Include Images from the ACF Fields” is ON’ is closed to new replies.