• Resolved samuelamiri

    (@samuelamiri)


    Hello AMP Support Team,

    I am experiencing a problem with the AMP plugin on my WordPress site. When I attempt to use the “Scan” button to scan my pages within the AMP plugin, it consistently fails and displays the message: “Scan was unsuccessful, try again.” Additionally, AMP pages fail to initialize properly, and I encounter the following PHP error:

    Call to a member function hasAttribute() on null (0) [Error]
    /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php:400 0 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php(336): AmpProject\Dom\Document->loadHTMLFragment(‘…’, Array) 1 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php(234): AmpProject\Dom\Document->loadHTML(‘…’, Array) 2 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(1969): AmpProject\Dom\Document::fromHtml(‘…’, Array) 3 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(1732): AMP_Theme_Support::prepare_response(‘…’) 4 [internal function]: AMP_Theme_Support::finish_output_buffering(‘…’, 9) 5 /home/voltag/domains/voltagate.com/public_html/wp-includes/functions.php(5373): ob_end_flush() 6 /home/voltag/domains/voltagate.com/public_html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all(”) 7 /home/voltag/domains/voltagate.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) 8 /home/voltag/domains/voltagate.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 9 /home/voltag/domains/voltagate.com/public_html/wp-includes/load.php(1260): do_action(‘shutdown’) 10 [internal function]: shutdown_action_hook() 11 {main}


    Certainly, here’s a revised version of your question for the AMP support forum, omitting the Persian text translation and adding the information about the scanning issue:

    Subject: Unsuccessful Scan and Initialization Error in AMP Plugin on Standard Mode

    Body:

    Hello AMP Support Team,

    I am experiencing a problem with the AMP plugin on my WordPress site. When I attempt to use the “Scan” button to scan my pages within the AMP plugin, it consistently fails and displays the message: “Scan was unsuccessful, try again.” Additionally, AMP pages fail to initialize properly, and I encounter the following PHP error:

    phpCopy code

    Call to a member function hasAttribute() on null (0) [Error] /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php:400 #0 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php(336): AmpProject\Dom\Document->loadHTMLFragment('<!DOCTYPE html>...', Array) #1 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php(234): AmpProject\Dom\Document->loadHTML('<!DOCTYPE html>...', Array) #2 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(1969): AmpProject\Dom\Document::fromHtml('<!DOCTYPE html>...', Array) #3 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(1732): AMP_Theme_Support::prepare_response('<!DOCTYPE html>...') #4 [internal function]: AMP_Theme_Support::finish_output_buffering('<!DOCTYPE html>...', 9) #5 /home/voltag/domains/voltagate.com/public_html/wp-includes/functions.php(5373): ob_end_flush() #6 /home/voltag/domains/voltagate.com/public_html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all('') #7 /home/voltag/domains/voltagate.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #8 /home/voltag/domains/voltagate.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /home/voltag/domains/voltagate.com/public_html/wp-includes/load.php(1260): do_action('shutdown') #10 [internal function]: shutdown_action_hook() #11 {main}

    Troubleshooting Steps Taken:

    1. Deactivated all other plugins except for AMP and switched to the default WordPress theme; the issue remains.
    2. Ensured WordPress, the AMP plugin, and PHP are all up to date.
    3. I am using AMP in Standard mode.

    I have not made significant changes to my website recently that might explain this issue. I am currently using WordPress version 6.4.3, PHP version 7.4, and the latest version of the AMP plugin and all of other plugins are up to date

    Could you please provide guidance or assistance in resolving both the scanning issue and the PHP error? Any help would be greatly appreciated.

    Thank you for your support.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @samuelamiri

    Can you please send us your site health information using this form

    Thread Starter samuelamiri

    (@samuelamiri)

    Hello @milindmore22
    Yeah I just submitted the form
    Please look at it

    Plugin Support Milind More

    (@milindmore22)

    Hello @samuelamiri

    Thank you for submitting us your site health information, We tried to locate the issue by replicating your site setup, but we didn’t locate any issues.

    We doubt that it might be related to your child theme, for further debugging we will recommend using health check and troubleshooting plugin

    To narrow down further, could you use the Health Check & Troubleshooting plugin and enable its troubleshooting mode.

    This mode disables active plugins and switches to a default theme safely since it only affects the experience of the logged-in user.

    We hope this is helpful!

    Thread Starter samuelamiri

    (@samuelamiri)

    Hello @milindmore22
    I’ve installed the Health Check & Troubleshooting Plugin and after that I’ve activated the plugin and then went to tools and then from there enabled troubleshooting and then enabled the AMP plugin
    But even after doing this the issue still persists and won’t go away:
    This is the error that I got on the main page of my website in case it helps:

    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.

    Call to a member function hasAttribute() on null (0) [Error] /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php:400#0 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php(336): AmpProject\Dom\Document->loadHTMLFragment('<!DOCTYPE html>...', Array) #1 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Dom/Document.php(234): AmpProject\Dom\Document->loadHTML('<!DOCTYPE html>...', Array) #2 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(1969): AmpProject\Dom\Document::fromHtml('<!DOCTYPE html>...', Array) #3 /home/voltag/domains/voltagate.com/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(1732): AMP_Theme_Support::prepare_response('<!DOCTYPE html>...') #4 [internal function]: AMP_Theme_Support::finish_output_buffering('<!DOCTYPE html>...', 9) #5 /home/voltag/domains/voltagate.com/public_html/wp-includes/functions.php(5373): ob_end_flush() #6 /home/voltag/domains/voltagate.com/public_html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all('') #7 /home/voltag/domains/voltagate.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #8 /home/voltag/domains/voltagate.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /home/voltag/domains/voltagate.com/public_html/wp-includes/load.php(1260): do_action('shutdown') #10 [internal function]: shutdown_action_hook() #11 {main}


    Plugin Support Milind More

    (@milindmore22)

    Hello @samuelamiri

    When you enable The health check and troubleshooting plugin, it should not affect your live site.

    Also, please let us know if you are using any mu-plugins (must use plugin) which may be creating conflicts.

    Please follow the following steps

    1. Install and activate the Health Check & Troubleshooting plugin.
    2. Navigate to Tools > Site Health > Troubleshooting.
    3. Enable trouble shooting mode
    4. Visit Appearance-> Themes -> Activate Your theme
    5. Visit Plugins-> Installed plugins -> Activate AMP plugin
    6. Visit plugin -> installed plugins and activate one of the plugin (only one at a time) which was active on your site
    7. Check AMP Page version of your page which caused the issue
    8. Do you found that issue?
    9. if yes then you found culprit report back to us, or check that plugins settings
    10. if not continue from step 6

    We hope this helps!

    Thread Starter samuelamiri

    (@samuelamiri)

    Hello @milindmore22
    As you said I’ve installed The health check and troubleshooting plugin, and enabled troubleshooting in tools, site health and troubleshooting

    And after that i went to appearance, themes and activated the Astra child theme and after activating the theme that I was using when the the issue occurred and checked my website which was working fine and then i went to plugins and enabled AMP plugin while troubleshooting
    and after doing this the error came up again so I haven’t done anything else yet

    Plugin Support Milind More

    (@milindmore22)

    Hello @samuelamiri

    Thank you for following steps, it appears that the error originates from your child theme, I will recommend checking with your child theme developer and get it fixed.

    Thread Starter samuelamiri

    (@samuelamiri)

    Hello @milindmore22
    But even on the default theme of WordPress I have this error though
    Are you sure the error originates from my child theme?

    Plugin Support Milind More

    (@milindmore22)

    Hello @samuelamiri

    Can you please switch to transitional mode for some time, we will find what is causing the issue.

    Plugin Support Milind More

    (@milindmore22)

    @samuelamiri 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.

    Thread Starter samuelamiri

    (@samuelamiri)

    Hello @milindmore22
    I’ve changed it to transitional mode
    Well the website is up and I don’t see the error on the home page
    But I see the error when I go to /?amp=1

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Error: “Call to a member function hasAttribute() on null’ is closed to new replies.