Hi @rnbee,
Thanks for getting in contact with us. In order to investigate this, you can please share your Site Health information along with the PHP error log using this form.
After sharing your Site Health information, please uninstall the plugin and install once more, before checking if this same error exists when adding or editing a post.
If the problem still happen, you can downgrade the AMP plugin at:
https://wordpress.org/plugins/amp/advanced/
Or install WP Rollback plugin and switch to the previous AMP plugin version 2.1.4
Note that uninstallation will now remove the plugin’s data. So I recommend re-installing the latest AMP plugin on top of the existing installation. You can download the ZIP from https://wordpress.org/plugins/amp/ and then install.
I think what may be happening is you have PHP OPCache which is holding onto a stale copy of class-amp-core-theme-sanitizer.php
, or a stale copy of what is in the amp-toolbox-php
dependency.
The amp-toolbox-php
library renamed AmpProject\Role
to AmpProject\Html\Role
, and you can see that the latest version of class-amp-core-theme-sanitizer.php
does use that: https://github.com/ampproject/amp-wp/blob/2.2.0/includes/sanitizers/class-amp-core-theme-sanitizer.php#L11
Whereas v2.1.4 used AmpProject\Role
: https://github.com/ampproject/amp-wp/blob/2.1.4/includes/sanitizers/class-amp-core-theme-sanitizer.php#L11
Nevertheless, amp-toolbox-php
also added a back-compat alias for this rename.
So I think either the plugin upgrade was incomplete or PHP OPcache needs to be flushed.
I have not used this plugin myself, but there is a WP OPcache plugin which provides a UI to flush the OPCache. Nevertheless, WordPress core as of v5.5 is supposed to flush the OPcache when updates are made (see #36455).
Thread Starter
rnbee
(@rnbee)
I removed the plugin, reinstalled it, cleared the cache. But all the same, a critical error occurs when a post with a map is published. If the recording is without a picture, then there is no error.
Plugin version 2.1.3 works without errors.
Версия WordPress 5.8.2
Текущая тема: Root Child (версия 1.0.0)
Проблемный плагин: AMP (версия 2.2.0)
Версия PHP 7.4.15
Error details
===================================
An error with type E_ERROR occurred on line 7 of the file/var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/vendor/autoload.php. Сообщение об ошибке: Uncaught Error: Class 'ComposerAutoloaderInitc1147c91d584620ff8c3a6f2cc17f214' not found in /var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/vendor/autoload.php:7
Stack trace:
#0 /var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/amp.php(241): require_once()
#1 /var/www/sel****/data/www/*****.ru/wp-settings.php(409): include_once('/var/www/sel***...')
#2 /var/www/sel****/data/www/*****.ru/wp-config.php(120): require_once('/var/www/seldon...')
#3 /var/www/sel****/data/www/*****.ru/wp-load.php(50): require_once('/var/www/seldon...')
#4 /var/www/sel****/data/www/*****.ru/wp-admin/admin-ajax.php(22): require_once('/var/www/sel***...')
#5 {main}
thrown
Sorry, I am not sure what is going on. It still seems like there is an OPcache issue or the plugin installation was incomplete.
The ComposerAutoloaderInitc1147c91d584620ff8c3a6f2cc17f214
class is indeed part of 2.2.0:
https://plugins.trac.wordpress.org/browser/amp/tags/2.2.0/vendor/autoload.php
https://plugins.trac.wordpress.org/browser/amp/tags/2.2.0/vendor/composer/autoload_real.php#L5
If you look at the vendor/composer/autoload_real.php
file on your system, do you see ComposerAutoloaderInitc1147c91d584620ff8c3a6f2cc17f214
being defined or is it the class from 2.1.3 (ComposerAutoloaderInitf103ddfda6fdabed50ebee17a649d2b4
).
Thread Starter
rnbee
(@rnbee)
Thanks for the answer
This is what I see in the file vendor/composer/autoload_real.php:
<?php
// autoload.php @generated by Composer
require_once __DIR__ . ‘/composer/autoload_real.php’;
return ComposerAutoloaderInitf103ddfda6fdabed50ebee17a649d2b4::getLoader();”
And here is what I see in the file vendor/composer/autoload_real.php:
`<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc1147c91d584620ff8c3a6f2cc17f214`
-
This reply was modified 1 year, 9 months ago by
rnbee.
OK, those files are from 2.1.3 not 2.2.0.
Thread Starter
rnbee
(@rnbee)
Ok, how do I fix this error?
@rnbee
It will best to contact your hosting provider and ask them to Clear PHP OPcache. once you install v2.2
Alternatively, you can try and use the plugin Weston mentioned in the previous reply ie WP OPcache
As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.