Support » Plugin: AMP » critical error

  • Resolved rnbee


    After updating the plugin, when trying to add a new post, a fatal error occurs.

    Details of the error
    An error with type E_ERROR occurred on line 310 of the file/var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/includes/sanitizers/class-amp-core-theme-sanitizer.php. Сообщение об ошибке: Uncaught Error: Class 'AmpProject\Role' not found in /var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/includes/sanitizers/class-amp-core-theme-sanitizer.php:310
    Stack trace:
    #0 /var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/includes/sanitizers/class-amp-core-theme-sanitizer.php(337): AMP_Core_Theme_Sanitizer::get_supported_themes()
    #1 /var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/includes/class-amp-theme-support.php(165): AMP_Core_Theme_Sanitizer::extend_theme_support()
    #2 /var/www/sel****/data/www/*****.ru/wp-content/plugins/amp/includes/amp-helper-functions.php(130): AMP_Theme_Support::init()
    #3 /var/www/sel****/data/www/*****.ru/wp-includes/class-wp-hook.php(303): amp_init('')
    #4 /var/www/sel****/data/www/*****.ru/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    #5 /var/www/sel****/data/www/*****.ru/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    #6 /var/www/sel****/data/www/*****.ru/wp-settings.php(578): do_action('init')
    #7 /var/www/sel****/da

    Help solve this problem

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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:

    Or install WP Rollback plugin and switch to the previous AMP plugin version 2.1.4

    Plugin Author Weston Ruter


    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 and then install.

    Plugin Author Weston Ruter


    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:

    Whereas v2.1.4 used AmpProject\Role:

    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


    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}
    Plugin Author Weston Ruter


    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:

    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


    Thanks for the answer

    This is what I see in the file vendor/composer/autoload_real.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:

    // autoload_real.php @generated by Composer
    class ComposerAutoloaderInitc1147c91d584620ff8c3a6f2cc17f214`

    • This reply was modified 1 year, 9 months ago by rnbee.
    Plugin Author Weston Ruter


    OK, those files are from 2.1.3 not 2.2.0.

    Thread Starter rnbee


    Ok, how do I fix this error?

    Plugin Support Milind More



    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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘critical error’ is closed to new replies.