PHP Notice with the AMP plugin
-
Hi there,
my error log is filled on every page request with an issue supposedly caused by your Shortpixel plugin.
It says that the
amp_is_available
function is called too early.I wasn’t even aware that your plugin has some AMP integration or check and would appreciate if you could take a look.
Thanks,
Thomas
-
Hello @webzunft,
I’m sorry to hear about this. To debug this further we need at least the following information:
- the full error log that you are mentioning (one entry, if all of them are identical)
- the list of active plugins & theme (or the site information taken from Tools -> Site Health -> Info)
We’ll do our best to reproduce this and check what is generating it. We do not have a direct integration with AMP plugins, but they might hook on the same hooks as our plugin and, depending on what those plugins are doing on those hooks, such logs might be generated.
Thanks, I look forward to hearing from you!
Hey Pedro,
this is what I have. The full error. They are all identical:
PHP Notice: Die Funktion amp_is_available wurde fehlerhaft aufgerufen.
amp_is_available()
(oderamp_is_request()
, zuvoris_amp_endpoint()
) wurde zu früh aufgerufen und funktioniert daher nicht ordnungsgemäß. WordPress is currently doing theshutdown
hook. Wenn diese Funktion vor der Aktionwp
aufgerufen wird, hat sie keinen Zugriff aufWP_Query
und das abgefragte Objekt, um zu bestimmen, ob es sich um eine AMP-Antwort handelt. Somit werden weder der Filteramp_skip_post()
noch der AMP-fähige Umschalter berücksichtigt. Anscheinend ist das Plugin mit der Titelformshortpixel-image-optimiser
verantwortlich; wende dich an den Autor. Weitere Informationen: <a>Debugging in WordPress (engl.)</a>. (Diese Meldung wurde in Version 2.0.0 hinzugefügt.) in /wp-includes/functions.php on line 6078Active plugins:
AMP: version: 2.5.3, author: AMP Project Contributors, Automatische Aktualisierungen deaktiviert
Antispam Bee: version: 2.11.6, author: pluginkollektiv, Automatische Aktualisierungen deaktiviert
Autoptimize: version: 3.1.11, author: Frank Goossens (futtta), Automatische Aktualisierungen aktiviert
Default featured image: version: 1.7.3, author: Jan Willem Oostendorp, Automatische Aktualisierungen deaktiviert
Easy FancyBox – WordPress Lightbox Plugin: version: 2.2.5, author: FirelightWP, Automatische Aktualisierungen deaktiviert
Easy Table of Contents: version: 2.0.67.1, author: Magazine3, Automatische Aktualisierungen aktiviert
Image Source Control: version: 2.24.0, author: Team Image Source Control, Automatische Aktualisierungen deaktiviert
Limit Login Attempts Reloaded: version: 2.26.11, author: Limit Login Attempts Reloaded, Automatische Aktualisierungen deaktiviert
Matomo Analytics – Ethical Stats. Powerful Insights.: version: 5.1.0, author: Matomo, Automatische Aktualisierungen deaktiviert
Prosodia VGW OS: version: 3.25.3, author: Prosodia – Verlag für Musik und Literatur, Automatische Aktualisierungen deaktiviert
Query Monitor: version: 3.16.3, author: John Blackbourn, Automatische Aktualisierungen aktiviert
ShortPixel Image Optimizer: version: 5.6.2, author: ShortPixel – Convert WebP/AVIF & Optimize Images, Automatische Aktualisierungen aktiviert
WP Super Cache: version: 1.12.2, author: Automattic, Automatische Aktualisierungen deaktiviert
Yoast SEO: version: 23.0, author: Team Yoast, Automatische Aktualisierungen aktiviertI am sure it is the AMP plugin. To me, this reads as if you might use one of the hooks mentioned in the error entries.
When I disable your plugin, the issue is no longer logged.
Thanks,
ThomasHello Thomas,
We checked the error and it is coming from the delivery method that you chose in our plugin settings. My best guess is that you are using the PICTURE tag delivery mode, with the “Global (processes the whole output buffer before sending the HTML to the browser)” option enabled. It looks like the AMP plugin is trying to process the output buffer as well and some of our code doesn’t get executed anymore, resulting in that PHP Notice over and over again.
The potential solutions would be:
- switch to another delivery method for WebP/AVIF: either via .htaccess, or NGINX rules
- if neither of the above work, try using “Only via WordPress hooks” instead of “Global“
- check if another AMP plugin works without generating those PHP Notices
- decrease your error level to only display Warnings and Errors, and not Notices
Please tell me if any of these suggestions works for you.
Thanks!
Hi Pedro,
thanks for the suggestions.
I switched to “Only via WordPress hooks” since the .htaccess option and article about it read a bit scary 🙂
I clicked through a few sites and the PHP error didn’t come back. I will check again on Monday. If the log is still empty, we can close this thread.
Thanks,
ThomasHi Thomas,
That’s great news, thanks for the confirmation. I see that the ticket is marked as resolved, therefore I assume everything is fine now and that PHP Notice is gone for good.
Don’t hesitate to let us know if you have any other questions or concerns.
- The topic ‘PHP Notice with the AMP plugin’ is closed to new replies.