Skip to content

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

Open
@ryangorley

Description

@ryangorley

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions