elementor / static-html-output

Static HTML Output Plugin for WordPress
https://statichtmloutput.com
The Unlicense
124 stars 33 forks source link

Critical error when <img srcset=""> #129

Open ryangorley opened 4 years ago

ryangorley commented 4 years ago

I'm not entirely sure why some of my images acquired an empty srcset="", but it is crashing the build due to HTMLProcessor.php line 635 expecting a string. I was able to work around this by getting rid of that blank attribute, but it is seems it could plausibly happen when someone else is using a site layout tool like I was which stuck those in there for some unknown reason. Here is the full log w/ stack trace:

Notice: Undefined offset: 0 in /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php on line 631
Notice: Undefined offset: 1 in /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php on line 632
Fatal error: Uncaught TypeError: Argument 1 passed to StaticHTMLOutput\HTMLProcessor::isInternalLink() must be of the type string, null given, called in /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php on line 635 and defined in /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php:864
Stack trace:
#0 /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php(635): StaticHTMLOutput\HTMLProcessor->isInternalLink()
#1 /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php(454): StaticHTMLOutput\HTMLProcessor->processImageSrcSet()
#2 /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/SiteCrawler.php(331): StaticHTMLOutput\HTMLProcessor->processHTML()
#3 /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/SiteCrawler.php(203): StaticHTMLOutput\SiteCrawler->loadFileForProcess in /sites/[website]/files/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php on line 864
Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website.
leonstafford commented 4 years ago

Hi @ryangorley - sorry for the big delay in responding. Thanks for reporting this, indeed a bug to be fixed!

thegulshankumar commented 4 years ago

By chance is there any Lazy Load Plugin active?

ryangorley commented 4 years ago

By chance is there any Lazy Load Plugin active?

Nope. I'm pretty sure the Oxygen builder was the source of the blank srcset.