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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mdrummond created an issue. See original summary.

RainbowArray’s picture

Found 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.

RainbowArray’s picture

Status: Active » Postponed (maintainer needs more info)

This 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.

KarenS’s picture

I'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.

KarenS’s picture

Status: Postponed (maintainer needs more info) » Active
SchnWalter’s picture

Running 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.

SchnWalter’s picture

The viewBox dimensions should be used for the <amp-img> dimensions only when the SVG doesn't have the height and width attributes defined.

I've also changed the code to load the logo files directly from the file system, and not use the internet.

tjwelde’s picture

We had a similar issue with TravisCI. I closed my ticket, since this solves it: https://www.drupal.org/node/2879082.

daniel.bosen’s picture

Status: Needs review » Reviewed & tested by the community

This patch works for us

Berdir’s picture

+1, nice to no longer have to load the file through the absolute URL.

  • KarenS committed f0a29e1 on 8.x-1.x authored by SchnWalter
    Issue #2753089 by SchnWalter, mdrummond, tjwelde, daniel.bosen, Berdir:...
KarenS’s picture

Status: Reviewed & tested by the community » Fixed

This is committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.