Error in plugin page
-
hi
after transferring the theme and woocommerce (po mo) file to loco folder an error showed up
Warning: Undefined property: DOMDocument::$documentElement in?/home/…./public_html/wp-content/plugins/loco-translate/src/config/XMLModel.php?on line?81
-
Thanks for reporting. This is the same error that I heard about for the first time a few days ago (see topic).
I need to understand how this can happen in order to replicate the error so I can fix it. Perhaps you can help me do that?
It would be useful to know which XML file is being loaded when this happens. Can you find out?
The reason I don’t understand the error is that
documentElement
is being tested (on line 81) after XML validation has passed. To my mind any valid document must have a documentElement, therefore it seems “impossible” at this point for documentElement to be undefined. Furthermore, the PHP DOM documentation states that this property is permitted to be null. Hence I just don’t get it without being able to see it happening.Hi Tim Thanks for reply ,
I don’t know how to find out which (XML) file is loaded
After reading that topic, I realized that this error was displayed when I changed the php version from 7.4 to 8.0.
I changed the php version again to 7.4 and the problem was solved!
This isn’t really a solution, but if you’re happy then that’s good.
I would still like to fix the issue.
There are probably very few loco.xml files on your system. At least one will be that which belongs to Loco Translate itself. If this file is causing the error, then I am clueless as to why. If you have any other such files on your system they will be in the root of themes and plugins. If you can see any then please post. Thanks.
I searched all the files with .xml extension in the host
/public_html/wp-includes/class-wp-xmlrpc-server.php
/public_html/wp-includes/wlwmanifest.xml
/public_html/wp-content/plugins/woocommerce/includes/legacy/api/v1/class-wc-api-xml-handler.php
/public_html/wp-content/plugins/woocommerce/sample-data/sample_products.xml
/public_html/wp-content/plugins/woocommerce/vendor/maxmind-db/reader/package.xml
/public_html/wp-content/plugins/woocommerce/packages/woocommerce-blocks/checkstyle.xml
/public_html/wp-content/plugins/yith-woocommerce-wishlist/wpml-config.xml
/public_html/wp-content/plugins/yith-woocommerce-wishlist/plugin-fw/phpcs.xml
/public_html/wp-content/plugins/loco-translate/loco.xml
/public_html/wp-content/themes/flatsome/wpml-config.xml
/public_html/wp-content/themes/flatsome/inc/builder/core/phpunit.xml.distDoes this help?
And I noticed another issue, when the php version changes to 8.1 , I get a new error on the plugin page:
Fatal error: Uncaught Error: Typed property DOMDocument::$documentElement must not be accessed before initialization in /home/…./public_html/wp-content/plugins/loco-translate/src/config/XMLModel.php:81 Stack trace: #0 /home/…./public_html/wp-content/plugins/loco-translate/src/config/BundleReader.php(27): Loco_config_XMLModel->loadXml() #1 /home/…./public_html/wp-content/plugins/loco-translate/src/package/Bundle.php(501): Loco_config_BundleReader->loadXml() #2 /home/…./public_html/wp-content/plugins/loco-translate/src/package/Bundle.php(599): Loco_package_Bundle->configureXml() #3 /home/…./public_html/wp-content/plugins/loco-translate/src/package/Plugin.php(261): Loco_package_Bundle->configure() #4 /home/…./public_html/wp-content/plugins/loco-translate/src/package/Bundle.php(108): Loco_package_Plugin::create() #5 /home/…./public_html/wp-content/plugins/loco-translate/src/package/Bundle.php(95): Loco_package_Bundle::createType() #6 /home/…./public_html/wp-content/plugins/loco-translate/src/admin/RootController.php(50): Loco_package_Bundle::fromId() #7 /home/…./public_html/wp-content/plugins/loco-translate/src/mvc/AdminRouter.php(244): Loco_admin_RootController->render() #8 /home/…./public_html/wp-includes/class-wp-hook.php(308): Loco_mvc_AdminRouter->renderPage() #9 /home/…./public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #10 /home/…./public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #11 /home/…./public_html/wp-admin/admin.php(259): do_action() #12 {main} thrown in?/home/…./public_html/wp-content/plugins/loco-translate/src/config/XMLModel.php?on line?81
Thanks for posting. The only loco.xml file I can see is my own one, so it seems like the error is coming from that, but I don’t understand how. Nor do I know how to reproduce the problem.
Upgrading to PHP 8.1 will indeed result in a fatal error, but this error is actually the same one. PHP 8.1 is just stricter.
I’m wondering whether the issue is some bug in a particular version of the DOM extension or libxml. Are you able to show me this information for your PHP 7.4, 8.0 and 8.1 installs respectively?
Hi Tim Thank you for your time
I think the problem is due to the limitations of shared hosting, because other sites do not have this problem, and unfortunately, the hosting support did not provide the requested information (DOM extension) .
I have 2 WordPresses running php 8.1. One is a live server, one is my PC. My PC is:
- DOM/XML API Version 20031129
- libxml Version 2.9.13
My server is same everything except libxml 2.9.10
My PC, the newer libxml, throws the fatal error, but the server does not.
@kerryoco You say this happens on a PC. Does that mean Windows?
As per my comments to the OP – Are you able to establish what XML file is being read when this error is thrown?
- The topic ‘Error in plugin page’ is closed to new replies.