Error: “Call to a member function hasAttribute() on null
-
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:
- Deactivated all other plugins except for AMP and switched to the default WordPress theme; the issue remains.
- Ensured WordPress, the AMP plugin, and PHP are all up to date.
- 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]
The topic ‘Error: “Call to a member function hasAttribute() on null’ is closed to new replies.