Support » Plugin: Open Graph and Twitter Card Tags » HTML truncated

  • Resolved jangrewe


    With PHP7 and version 2.0.7 of the plugin, it truncates some of my pages at the location where the header tags would be inserted. If i deactivate the plugin, the page renders fine. If i activate it, i only get a white page (because it doesn’t even start rendering the <body> section). This does not happen for all posts, but some of them.
    No errors are logged, unfortunately.

Viewing 15 replies - 1 through 15 (of 18 total)
  • I have the same error it has to do with the image that should be provided as og:image.

    The code that figures out the image dimensions for some images throws a Fatal Error.

    If you comment out line 834 in file class-webdados-fb-open-graph-public.php it works again.

    The plugin tries to get the image size by only loading a small part of the image for speed reasons but this gives the Fatal Error. I think it was(?) only a warning in other PHP Versions that should not stop the script, but the Fatal Error does, hence the HTML is truncated.
    In Line 834 is where the script asks for only a part of the image file, commenting it out tells the script to load the whole image and then in works.

    Sorry for the delay.

    Can you please give us some more information on the server setup?
    We’re trying to replicate this problem on PHP7 without much luck.

    Anyway, we’re going to try to catch the error so it doesn’t halt the PHP processing and try to fetch the complete image if it happens.

    This is a problem with our technique of getting the image size using just a part of the image to speed things up.

    This is addressed in the next version, 2.0.8

    Please get back to us, on this post, and tell us if this is fixed for you after update.

    Thread Starter jangrewe


    This still happens with
    I’m running nginx with php-fpm and PHP7.

    I can work around this by commenting out line 846 in “public/class-webdados-fb-open-graph-public.php”

    • This reply was modified 4 years, 7 months ago by jangrewe.

    We need to see the error_log to identify what’s actually happening

    Thread Starter jangrewe


    My error logs for nginx and php-fpm are both empty, that’s why it’s so frustrating!

    And if you activate WP_DEBUG temporarily, also no error on screen / HTML code?

    Thread Starter jangrewe


    Even with WP_DEBUG enabled i don’t see anything.
    Yes, i do have curl and the corresponding PHP module, and you plugin works fine for some posts: yesterday i create 2 new posts, both with just a photo in it, and one of them is working fine, while the other’s HTML is truncated.
    Both were JPEGs exported from Lightroom, with “web-safe” filenames.

    Can you send me the JPG image (of the post having the problem) to info @ webdados . pt?

    Hey @censor, I’ve been debugging the same for HOURS. It looks like the problem can be fixed with new options in settings -> “Do not get image size”.

    It’s been frustrating, as my logs where also empty even with all debugging options enabled. And in my case it was only one page.

    @webdados, I don’t think that such option “in case of emergency” should be considered in first place. As the problem was only on one page, no error shown, and no content shown I had no clue where to start searching. And only after commenting many line-by-line’s I found it to be your plugin. Then i debugged whole plugin code, and finally – found out the option in settings.

    @neonkowy this happens when trying to get the image size in very rare circumstances that we’ve failed to identify so far. That’s why this is an “in case of emergency” option.

    Hey @webdados,

    So maybe I can provide some information to debug this one? I left aside that problematic page, so I still can test it 🙂

    The problem is, that even enabling all errors in PHP I can’t see anything. It’s a blank page, in page source there’s nothing, Apache in debug mode says nothing.

    I’m familiar with PHP – I can help, dump, debug what you think should help. I spent so many hours on this so it’s become my personal challenge 😉

    The problem is, that even enabling all errors in PHP I can’t see anything. It’s a blank page, in page source there’s nothing, Apache in debug mode says nothing.

    That’s exactly the problem.

    You can probably comment php lines one by one until the error goes away. This is related to the code that gets the image size.

    @webdados, got it!

    I dumped whole curl response and I found out that this one happens only if curl got 301 or 302 MOVED response.

    That’s because i recently switched from http to https, and probably some links were somehow not updated.

    just add curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);

    in get_open_graph_image_size_curl function, and everythings working fine without any strange workarounds.

    And all because of curl not passing errors to PHP 🙂

    Let me know, when it will be fixed upstream, so I can them update your plugin once for all.


    Good one!

    I’ll add that to the plugin right away.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘HTML truncated’ is closed to new replies.