I have a site that doesn't use a logo, so when I set up the AMP theme options I chose the option to not display a logo (by unchecking the box to use the default logo and not providing any other logo either). This works fine on normal pages. But on the AMP pages I get the following, followed by several lines of stack tracing:

Warning: get_headers() expects parameter 1 to be string, array given in amptheme_preprocess_html() (line 60 of themes/contrib/amptheme/amptheme.theme).

The problem is the theme is getting the url array and converting it to a string if the url is not empty. But if there is no logo you have an array and the url is empty, which isn't addressed. Then you end up trying to pass the array to get_headers(), which explodes.

I have a fix attached.

CommentFileSizeAuthor
#4 empty-logo.diff826 byteskarens
#3 empty-logo.diff808 byteskarens
empty-logo.diff792 byteskarens

Comments

KarenS created an issue. See original summary.

karens’s picture

Title: Error messages if these has no logo » Error messages if theme has no logo
karens’s picture

StatusFileSize
new808 bytes

This error is still happening, but the patch file had a mistake in it. Trying again.

karens’s picture

StatusFileSize
new826 bytes

Still wrong, one more try.

karens’s picture

rainbowarray’s picture

Status: Needs review » Closed (duplicate)

This will no longer be necessary with #2745227: Remove JSON output by AMP theme removing this logo URL parsing code.