• Resolved xxxLesy

    (@xxxlesy)


    I’m getting various white screens after upgarding to php 8.0.16 most notably on site health page and amp settings.

    Here’s the amp settings error:
    /wp-admin/admin.php?page=amp-options
    /wp-admin/site-health.php (identical error on both)
    WordPress 5.9.1
    Theme: Newspaper (11.4.1)
    Current plugin: AMP (2.2.1)
    PHP 8.0.16

    Error type E_ERROR was caused in line 548 of the file /var/www/vhosts/[siteurl]/httpdocs/wp-content/plugins/amp/src/Admin/SiteHealth.php. Error message: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /var/www/vhosts/.../httpdocs/wp-content/plugins/amp/src/Admin/SiteHealth.php:548
    Stack trace:
    #0 /var/www/vhosts/.../httpdocs/wp-content/plugins/amp/src/Admin/SiteHealth.php(548): preg_match()
    #1 /var/www/vhosts/.../httpdocs/wp-content/plugins/amp/src/Admin/SiteHealth.php(634): AmpProject\AmpWP\Admin\SiteHealth::AmpProject\AmpWP\Admin\{closure}()
    #2 /var/www/vhosts/.../httpdocs/wp-content/plugins/amp/src/Admin/SiteHealth.php(491): AmpProject\AmpWP\Admin\SiteHealth->check_for_page_caching()
    #3 /var/www/vhosts/.../httpdocs/wp-content/plugins/amp/src/Admin/OptionsMenu.php(230): AmpProject\AmpWP\Admin\SiteHealth->get_page_cache_detail()
    #4 /var/www/vhosts/.../httpdocs/wp-includes/class-wp-hook.php(307): AmpProject\AmpWP\Admin\OptionsMenu->enqueue_assets()
    #5 /var/www/vhosts/.../httpdocs/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #6 /var/www/vhosts/.../httpdocs/wp-includes/plugin.php(474): WP_Hook->do_action()
    #7 /var/www/vhosts/.../httpdocs/wp-admin/admin-header.php(118): do_action()
    #8 /var/www/vhosts/.../httpdocs/wp-admin/admin.php(239): require_once('...')
    #9 {main}
      thrown
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @xxxlesy,

    Thanks for contacting us, we have a fix related to this issue for version 2.2.2.

    Thread Starter xxxLesy

    (@xxxlesy)

    Awesome. Thank you!

    Plugin Author Weston Ruter

    (@westonruter)

    You can use the fix now by installing the pre-release 2.2.x production build.

    Thread Starter xxxLesy

    (@xxxlesy)

    Works now. Thank you!

    Thread Starter xxxLesy

    (@xxxlesy)

    Nope, error on actual articles now. None of the amp posts work.

    Failed to prepare AMP page

    A PHP error occurred while trying to prepare the AMP response. This may not be caused by the AMP plugin but by some other active plugin or the current theme. You will need to review the error details to determine the source of the error.
    
    If you get stuck, you may want to share any details in a new topic on the plugin's support forum.
    
    The exact details of the error are hidden for security reasons. To learn more about this error, enable the WordPress debugging display (by setting both WP_DEBUG and WP_DEBUG_DISPLAY to true), or look into the PHP error log. Learn more about Debugging in WordPress.
    Couldn't fetch AmpProject\Dom\Element (0) [Error]
    /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Optimizer/Transformer/OptimizeHeroImages.php:474
    
    #0 /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Optimizer/Transformer/OptimizeHeroImages.php(474): DOMElement->getAttribute()
    #1 /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Optimizer/Transformer/OptimizeHeroImages.php(183): AmpProject\Optimizer\Transformer\OptimizeHeroImages->removeLazyLoading()
    #2 /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Optimizer/TransformationEngine.php(78): AmpProject\Optimizer\Transformer\OptimizeHeroImages->transform()
    #3 /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/src/Optimizer/OptimizerService.php(46): AmpProject\Optimizer\TransformationEngine->optimizeDom()
    #4 /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/includes/class-amp-theme-support.php(2131): AmpProject\AmpWP\Optimizer\OptimizerService->optimizeDom()
    #5 /var/www/vhosts/student.si/httpdocs/wp-content/plugins/amp/includes/class-amp-theme-support.php(1750): AMP_Theme_Support::prepare_response()
    #6 [internal function]: AMP_Theme_Support::finish_output_buffering()
    #7 /var/www/vhosts/student.si/httpdocs/wp-includes/functions.php(5212): ob_end_flush()
    #8 /var/www/vhosts/student.si/httpdocs/wp-includes/class-wp-hook.php(307): wp_ob_end_flush_all()
    #9 /var/www/vhosts/student.si/httpdocs/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #10 /var/www/vhosts/student.si/httpdocs/wp-includes/plugin.php(474): WP_Hook->do_action()
    #11 /var/www/vhosts/student.si/httpdocs/wp-includes/load.php(1100): do_action()
    #12 [internal function]: shutdown_action_hook()
    #13 {main}
    • This reply was modified 2 years, 8 months ago by xxxLesy.
    Plugin Author Weston Ruter

    (@westonruter)

    That’s a strange one: Couldn't fetch AmpProject\Dom\Element. I’ve never seen that before.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Uncaught TypeError after php8’ is closed to new replies.