Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If simplexml_load_file returns FALSE in preprocess_block, this generates an error message. Check to see if this returns FALSE before proceeding with using the result.
Comment | File | Size | Author |
---|---|---|---|
#7 | amptheme-do_not_use_the_network_for_loading_logo_information-2753089-7.patch | 4.94 KB | SchnWalter |
#6 | amptheme-fix_reading_logo_attributes-2753089-6.patch | 791 bytes | SchnWalter |
Comments
Comment #2
RainbowArrayFound this was due to a Docker networking error. Errors are still generated even if you check for simplexml_load_file returning false, so not sure how best to prevent that.
Comment #3
RainbowArrayThis error went away once I set up a more complete PHP configuration for the Docker container. So I don't think this is necessarily an issue we need a lot of checks around. I'll leave this issue at postponed for a while in case anybody else comes across this.
Comment #4
KarenS CreditAttribution: KarenS at Lullabot commentedI'm running into this and we definitely need to wrap this code with a check to be sure we have a valid value before moving forward. It's the cause of https://www.drupal.org/node/2829783. For some reason the svg never works for me and apparently for others, so the "fix" is to upload a non-svg image instead. The test won't make it work right but will prevent fatal errors at least. I don't know why it isn't working.
I'm running into this on numerous different configurations, including a full-featured docker container created by Kalabox.
Comment #5
KarenS CreditAttribution: KarenS at Lullabot commentedComment #6
SchnWalter CreditAttribution: SchnWalter as a volunteer and commentedRunning on localhost with a self generated SSL certificate causes simplexml_load_file() to fail.
Attached a quick fix that just checks if the XML object exists before trying to read the attributes, but I believe that a proper fix would be to not use the network in order to load the SVG markup.
Comment #7
SchnWalter CreditAttribution: SchnWalter as a volunteer and commentedThe viewBox dimensions should be used for the
<amp-img>
dimensions only when the SVG doesn't have theheight
andwidth
attributes defined.I've also changed the code to load the logo files directly from the file system, and not use the internet.
Comment #8
tjwelde CreditAttribution: tjwelde at Thunder commentedWe had a similar issue with TravisCI. I closed my ticket, since this solves it: https://www.drupal.org/node/2879082.
Comment #9
daniel.bosenThis patch works for us
Comment #10
Berdir+1, nice to no longer have to load the file through the absolute URL.
Comment #12
KarenS CreditAttribution: KarenS at Lullabot commentedThis is committed. Thanks!