• Resolved Fibro Jedi

    (@fibrojedi)


    Hey,

    So I was trying to debug a totally unrelated issue but when I went into the error log, it was mostly full of Jetpack Boost errors

    H01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: WP_HTML_Tag_Processor::get_updated_html(): Return value must be of type string, null returned in /home/site/public_html/wp-includes/html-api/class-wp-html-tag-processor.php:4146\n

    Stack trace:\n

    #0 /home/site/public_html/wp-content/plugins/jetpack-boost/jetpack_vendor/automattic/jetpack-image-cdn/src/class-image-cdn.php(699): WP_HTML_Tag_Processor->get_updated_html()\n

    #1 /home/site/public_html/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Image_CDN\Image_CDN::filter_the_content(NULL)\n

    #2 /home/site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)\n

    #3 /home/site/public_html/wp-includes/formatting.php(3984): apply_filters(‘the_content’, ‘[menu_anchor][t…’)\n

    #4 /home/site/public_html/wp-includes/class-wp-hook.php(324): wp_trim_excerpt(‘[menu_anchor][t…’, Object(WP_Post))\n

    #5 /home/site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(”, Array)\n

    #6 /home/site/public…’, referer: https://site.not.real

    These things can be caused by knock-on effects or errors bouncing off each other. Many of the posts started with

    [fj_dfi][menu_anchor][toc]

    as they’re template-like things that I don’t need on every page.
    [fj_dfi] one pulls in the featured image in the right place.
    [menu_anchor] just inserts a small bit of standard HTML
    [toc] inserts my own table-of-contents feature.

    I’ve shared that just in case that was relevant. But those features aren’t creating other errors by existing there. It’s not just happening on any particular post or page, or type either.

    If this is my end/fault, then that’s fine, but I’m struggling to see how to fix this so that I can go back to debugging what I was originally doing.

    Thanks in advance,

    FJ

    Info:

    • Latest WordPress version: Yes
    • Latest JP Version: Yes
    • Server: Unix/Linux
    • I tried to reproduce this on a local environment, but I cannot activate any of the features on localhost because my “website is not publicly available”.



Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Stef (a11n)

    (@erania-pinnera)

    Hi there, @fibrojedi,

    Thanks for your thorough investigation on the error you found. As far as I can see, the error is likely triggered when Jetpack Boost’s Image CDN processes content that returns null; it can be often from triggered custom shortcodes like [fj_dfi][menu_anchor][toc].

    There are a few tests you can do to narrow down the root of the issue:

    • Test the shortcode validation, by ensuring that all custom shortcodes always return a string (empty string '' if no output). You should test with and without normal input.
    • Temporarily deactivate all your plugins and check if the problem gets fixed that way. If it works, then reactivate each plugin one by one to find out which one is causing problems.
    • Temporarily switch your theme to Twenty Twenty-Three and see if the problem persists.
    • Try disabling Boost’s Image CDN or modules filtering post content. If the error stops.
    • Ensure wp-content, Boost cache folders, and config files have proper permission, and clear /wp-content/boost-cache/ and reset caching if needed.

    Hope that’s all clear! Let us know what you find out. Meanwhile, you can also post your site URL here so that we can have a look. If you want it to remain private, you can also contact us via contact form. If you choose to reach out directly, please include a link to this thread.

    Speak soon 🙂

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Thanks – I can try some of those, but this is a live – and very busy – site, so deactivating plugins and switching theme will just break everything.

    My site does not need to remain private, I just didn’t want my paths “out there”. https://fibrojedi.me.uk/

    I have a fair amount to do on the blog today but will try to do some of those tests tonight or tomorrow. In the least I can check the shortcodes – AFAIK those ones should return an empty string rather than null, but I’ll double-check.

    Summary
    I will test:

    1. Shortcode output for null values
    2. Disabling the image CDN
    3. Clearing the Cache folder and check folder permissions.

    Feel free to see what you can from an outsider’s perspective.

    Thanks!

    FJ

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Hey,

    I have an update:

    • I fixed the possibility of [fj_dfi] returning null, though usually it only goes in in pages where it will output something.
    • [menu_anchor] and [fj_toc] shortcodes always output something, even if it’s an empty string (so they’re never null).
    • “boost-cache” and related folders are CHMOD 755 as they should be.
    • When I deactivated the image CDN the errors went away. (Without clearing the cache)
    • I did a deactivate and reactivate of the whole plugin and let it regenerate critical CSS. Then I re-enabled image CDN. Apart from getting error messages from my Redis Cache during that time, it went smoothly.
    • I can’t tell you if the errors are back yet as I’ll need time for different people to use the site to check that.

    Initial note: fixing the “returning null of a shortcode” may have helped, so potentially that’s just an edge case to handle in the Image CDN integration?

    [fj_dfi] inserts the featured image in place of the shortcode. So it is image-related.

    I’ll check back tomorrow and let you know whether or not more errors have cropped up from the above changes. If they do, I’ll do the cache clear check.
    Thanks,
    FJ

    Plugin Support Stef (a11n)

    (@erania-pinnera)

    Hi there, @fibrojedi,

    This is terrific troubleshooting, thanks so much for running it so smoothly and fast! It sounds like you did make progress, and we’re close to figure it out. Keep us posted on the next finding 🙂

    For the record (and I think you might know that already), you could also setup a live staging site to test things though, so you don’t affect your production site in case something gets off.

    While I was investigating the potential CDN conflict you reported, I noticed that Boost isn’t currently able to connect as expected, due to a block happening on your server’s end. It’s likely due to Cloudflare, so before going deeper in locating the block source in your servers, I’d recommend to make sure that you’ve followed the following guides, which outline the proper setup for Jetpack and Cloudflare:

    Deactivating temporarily Cloudflare will tell us if it’s the root of the conflict, if the above won’t work.

    Hope that helps! Let me know what you find out, and thanks again for sorting this out with us!

    Thread Starter Fibro Jedi

    (@fibrojedi)

    I hadn’t even thought about Cloudflare being a potential conflict TBH. I’ll have a look into it after the weekend.

    Some of those steps I have in place (like excluding the dashboard from cache) but I don’t use the CF plugin as I didn’t see a benefit before. But I can, as part of testing.

    Did the Errors Return?

    Sadly, yes. I’ll look at this specific URL now, as it’s a particular post type and I can’t afford (traffic-wise) for that content to break.

    But this post_type doesn’t include the shortcodes I looked out from other posts. I’ll see what could possibly causing a null in the code now before I break for the weekend.

    'PHP message: PHP Fatal error:  Uncaught TypeError: WP_HTML_Tag_Processor::get_updated_html(): Return value must be of type string, null returned in /home/site/public_html/wp-includes/html-api/class-wp-html-tag-processor.php:4146\nStack trace:\n#0 /home/site/public_html/wp-content/plugins/jetpack-boost/jetpack_vendor/automattic/jetpack-image-cdn/src/class-image-cdn.php(699): WP_HTML_Tag_Processor->get_updated_html()\n#1 /home/site/public_html/wp-includes/class-wp-hook.php(324): Automattic\\Jetpack\\Image_CDN\\Image_CDN::filter_the_content(NULL)\n#2 /home/site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)\n#3 /home/site/public_html/wp-includes/formatting.php(3984): apply_filters('the_content', 'Because there a...')\n#4 /home/site/public_html/wp-includes/class-wp-hook.php(324): wp_trim_excerpt('Because there a...', Object(WP_Post))\n#5 /home/site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('', Array)\n#6 /home/site/public...', referer: https://fibrojedi.me.uk/ffxiv-enemies/nix/

    Edit: Looking at the error log, it’s not just posts or post_types. This error is also being tripped on a category page like – https://fibrojedi.me.uk/category/lotro/.

    Excerpt?

    I was curious – looking at the error – because it seems to be the wp_trim_excerpt() causing and issue. Why, though, I don’t know.

    AFAIK, the only interaction my site has directly with the excerpt is this function


    function fibrojedi_remove_shortcode_from_excerpt($content) {
    //https://wordpress.stackexchange.com/questions/112010/strip-shortcode-from-excerpt
    if(!is_null($content)){
    $content = str_replace(“[fj_toc]”,””,$content);
    $content = str_replace(“[fj_dfi]”,””,$content);
    $content = str_replace(“[menu_anchor]”,””,$content);
    $content = str_replace(“Post Sections”,””,$content);
    $content = str_replace(“Hide”,””,$content);
    $content = str_replace(“Show”,””,$content);
    $content = strip_shortcodes( $content );
    }
    return $content;
    }
    add_filter(‘the_excerpt’, ‘fibrojedi_remove_shortcode_from_excerpt’);

    I had seen, in categories, that if I hadn’t pre-populated an excerpt (ain’t nobody always got time for that) then the system was inserting one but including printing out shortcodes. Odd for WP to do that at all.

    So I did my own function to clear out certain shortcodes and phrases on UI elements that had nothing to do with the intro text.

    I don’t know if it’s related, but, as you can see, it should not return null provided that $content isn’t null at the start.

    Thinking about it, maybe I should force it to return a blank string if it’s null but I might be looking in the wrong rabbit hole here.

    XML-RPC

    However, I may have manually added my own off-cloudflare rule around xmlrpc.php which, without knowing in advance, may have also caused hiccups. I’ve been hit a few times with…outside forces…trying to do their thing on that PHP file in the past, but I’m not totally blocking it either.

    Edit: Using the plugin WP-Hide, I had, in fact, renamed xmlrpc as I don’t use another plugin that requires “outside in” access. I’ve put it back to the default for now. Their setting did allow for a block on the default file but I didn’t enable that, so in theory it shouldn’t have caused the issue. But there’s theory…then there’s reality!

    Occasionally in the log there is a reference like the below. But not all the IPs that triggered the original error could be linked to the below error either. In fact, it was the minority where they were linked (by IP and timestamp).

    [access_compat:error] [pid 397775:tid 397775] [client 172.70.55.38:56194] AH01797: client denied by server configuration: …/xmlrpc.php

    SSL/HTTPS

    Re: HTTPS: everything is SSL, but I don’t mind adding the extra wp-config rule. It won’t make a difference to my SSL-everywhere-and-redirects-in-case-of-HTTP approach – but it won’t harm to add them either.

    I’ll run the other tests and things next week (it’s late on Saturday and I have Sundays off blog stuff).

    I know Jetpack can’t (and shouldn’t) offer customer support for Cloudflare, but if one of your plugins detects it in use, sending a notification to read the articles you just linked might be an idea?

    • This reply was modified 7 months, 2 weeks ago by Fibro Jedi. Reason: Adding edits to clarify where the error was found on-site and additional info on xmlrpc.php
    • This reply was modified 7 months, 2 weeks ago by Fibro Jedi. Reason: added a thought about excerpts as they are mentioned in the original error
    Plugin Support Stef (a11n)

    (@erania-pinnera)

    Hi @fibrojedi,

    Thanks for keep digging on it and for sharing your thought process. Let us know how this week’s test go, and we might involve our tech team depending on your findings.

    As for this:

    I know Jetpack can’t (and shouldn’t) offer customer support for Cloudflare, but if one of your plugins detects it in use, sending a notification to read the articles you just linked might be an idea?

    This seems to be a great enhancement request! Would you mind reporting it to our product team directly via this GH link? I don’t know if this is easily doable but I do believe it’s worth a report 🙂

    Speak soon!

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Sorry for the delay. We had really warm temperatures and horrid humidity – my office is a large shed in the garden so it got over warm so I couldn’t be in there.

    Enhancement Suggestion…Suggestion

    I certainly can!

    Debugging?

    I’m not sure what was left to do at this point. I made the changes to XML-RPC and the wp-config files a few days ago and they haven’t stopped the exact same error from re-surfacing today.

    Evidence

    [Tue Aug 19 23:09:24.668598 2025] [proxy_fcgi:error] [pid 1256790:tid 1256790] [client 172.71.223.96:60126] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: WP_HTML_Tag_Processor::get_updated_html(): Return value must be of type string, null returned in /home/site/public_html/wp-includes/html-api/class-wp-html-tag-processor.php:4146\nStack trace:\n#0 /home/site/public_html/wp-content/plugins/jetpack-boost/jetpack_vendor/automattic/jetpack-image-cdn/src/class-image-cdn.php(699): WP_HTML_Tag_Processor->get_updated_html()\n#1 /home/site/public_html/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Image_CDN\Image_CDN::filter_the_content(NULL)\n#2 /home/site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)\n#3 /home/site/public_html/wp-includes/formatting.php(3984): apply_filters(‘the_content’, ‘One of the more…’)\n#4 /home/site/public_html/wp-includes/class-wp-hook.php(324): wp_trim_excerpt(‘One of the more…’, Object(WP_Post))\n#5 /home/site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(”, Array)\n#6 /home/site/public…’

    Cloudflare Things Done
    From the two articles you linked re: Cloudflare, here are my notes:

    • SSL/HTTPS
    • It’s not a 5XX error
    • Rocket Loader isn’t on
    • Anything that is in a Cloudflare paid package or tier is irrelevant as I’ve always been on free.
    • I’m not blocking XML-RPC (currently)

    What’s Left?

    As far as I can tell, the only thing I haven’t done yet is disable Cloudflare completely to see if the error goes away. Is that right?

    Thanks.

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Additional Check – htaccess

    I just spotted in the error log that xmlrpc.php was still blocked. So I checked the htaccess and I still had a <Files> rule doing just that.

    I’ve deactivated that (for now).

    I won’t disable Cloudflare yet, under the “Change one thing at once else no one knows what caused anything” approach.

    Edit: Out of curiosity, if this does seem to fix it, how can I make the rule so JP can do its work while keeping it blocked from everyone else?

    <Files xmlrpc.php>
    Order deny,allow
    Deny from all
    Allow from .wp.com
    </Files>

    I took .wp.com from the fact that you’re matching ^http(s)?://i[\d]{1}.wp.com in class-image-cdn.php (Line 689)

    • This reply was modified 7 months, 2 weeks ago by Fibro Jedi.
    Plugin Author Brandon Kraft

    (@kraftbj)

    Code Wrangler

    Thanks for opening the GitHub issue. I’ll have the engineering teams take a closer look at it.

    For the error you passed along, it seems that something may be conflicting with the_content value that is passed between various plugins. The error is stating that Jetpack’s CDN is taking the_content and starting a HTML processor from WordPress itself…but the value of the_content is null, which WordPress isn’t expecting.

    I opened an issue and sent up a patch to WordPress to address not throwing a fatal error when that happens ( https://core.trac.wordpress.org/ticket/63854 ), though, I am not sure where the null value is coming from.

    Thread Starter Fibro Jedi

    (@fibrojedi)

    No, I’m a bit mystified by that myself. As it’s site-wide for me, I can’t pin it down to any particular script, template file, or plugin. And I’ve coded much of the functionality myself so I was 100% open to this being my fault.

    So it’s tough to trace what, on my side, could be triggering it. Looking at your bug report, it seems you have some support, along with a defensive approach to prevent misuse. So thanks for that.

    Am I safe to put back into place some of what I undid for testing, or should I leave it as-is for now?

    (Finally, as the issue isn’t, strictly-speaking “mine” as it’s been pushed up to WP, I can also mark this as resolved if that helps?)

    Plugin Author Pete (a11n)

    (@dilirity)

    Hey @fibrojedi!

    Am I safe to put back into place some of what I undid for testing, or should I leave it as-is for now?

    Anything you did to assist in debugging the issue can be removed.

    As for the topic – feel free to mark it as resolved and keep an eye on the ticket @kraftbj mentioned.

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

The topic ‘Error Log Full of JP Boost errors’ is closed to new replies.