• Resolved cmeeren

    (@cmeeren)


    I recently upgraded my server distribution, and after upgrading I get the following error whenever wp-typography is installed (from my experimentation it seems it doesn’t even have to be enabled). Do you know what could be wrong? Google did not turn up anything that helped me solve the problem.

    <b>Fatal error</b>:  Uncaught Error: Class 'DOMImplementation' not found in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php:169
    Stack trace:
    #0 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5.php(170): Masterminds\HTML5\Parser\DOMTreeBuilder->__construct(false, Array)
    #1 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5.php(98): Masterminds\HTML5->parse(Object(Masterminds\HTML5\Parser\StringInputStream), Array)
    #2 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php(231): Masterminds\HTML5->loadHTML('<!DOCTYPE html>...')
    #3 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php(149): PHP_Typography\PHP_Typography->parse_html(Object(Masterminds\HTML5), 'Body', Object(PHP_Typography\Settings in <b>/var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php</b> on line <b>169</b><br />

    The error was only visible on the public page, not the admin page.

    Thanks!

    • This topic was modified 6 years, 9 months ago by cmeeren.
    • This topic was modified 6 years, 9 months ago by cmeeren.
    • This topic was modified 6 years, 9 months ago by cmeeren.
    • This topic was modified 6 years, 9 months ago by cmeeren.

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

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author pepe

    (@pputzer)

    Either your libxml was compiled with --disable-dom or your PHP installation is missing the DOM extension.

    Thread Starter cmeeren

    (@cmeeren)

    Thanks for the prompt response! Indeed, the DOM extension was not enabled. I added extension=dom to my php.ini and now it works.

    Thanks again!

    Thread Starter cmeeren

    (@cmeeren)

    Hi, I’m having a similar problem that cropped up out of nowhere:

    <br />
    <b>Fatal error</b>:  Uncaught TypeError: Argument 2 passed to PHP_Typography\PHP_Typography::query_tags_to_ignore() must be an instance of DOMNode, null given, called in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php on line 159 and defined in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php:282
    Stack trace:
    #0 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php(159): PHP_Typography\PHP_Typography->query_tags_to_ignore(Object(DOMXPath), NULL, Object(PHP_Typography\Settings))
    #1 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php(103): PHP_Typography\PHP_Typography->process_textnodes('Body', Object(Closure), Object(PHP_Typography\Settings), true, Array)
    #2 /var/www/relativisticramblings.com/wp-content/plu in <b>/var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php</b> on line <b>282</b><br />

    Do you have any idea what’s wrong?

    Plugin Author pepe

    (@pputzer)

    Does this only happen with a specific page or are you experimenting with the API? i’m wondering because of the 'Body' argument to process_textnodes.

    Thread Starter cmeeren

    (@cmeeren)

    I’m not experimenting with anything. It happens with any page on my WP site as long as wp-typography is installed (regardless of whether or not it’s activated in the plugin listing).

    Plugin Author pepe

    (@pputzer)

    That can’t be quite right. If wp-Typography were disabled, that code would not be executed. Could you describe your exact setup (OS, PHP version, HTTP server, singlesite/multisite etc.)? Also, could you try to expand the stack trace? It only goes back two levels, which does not reach the plugin code itself (only the embeded php-typography library).

    From that stacktrace, $xpath->query( '/html/body' )->item( 0 ); returns null instead of a DOMNode object. That is weird because <body> tag is explicitly added around the parsed fragment, so that call should always return the outer-most <body> node that was added by the plugin.

    Thread Starter cmeeren

    (@cmeeren)

    That can’t be quite right. If wp-Typography were disabled, that code would not be executed.

    I’d think so too, but that’s not what I’m observing.

    I’m using Ubuntu 18.04 LTS, PHP 7.2, Apache 2.4.29, single-site.

    How can I expand the stack trace? To get the trace I posted, I just added the following to to index.php:

    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    Plugin Author pepe

    (@pputzer)

    Try this Gist. It will log to an error file instead of displaying the errors on the frontend. The output should include the complete stack trace.

    Thread Starter cmeeren

    (@cmeeren)

    [03-Jul-2018 20:32:14 UTC] PHP Notice:  Undefined property: DOMDocument::$documentElement in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 265
    [03-Jul-2018 20:32:14 UTC] PHP Notice:  Undefined property: DOMDocument::$documentElement in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 265
    [03-Jul-2018 20:32:14 UTC] PHP Notice:  Undefined property: DOMDocument::$documentElement in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 265
    [03-Jul-2018 20:32:14 UTC] PHP Notice:  Undefined property: DOMElement::$tagName in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 650
    [03-Jul-2018 20:32:14 UTC] PHP Notice:  Undefined property: DOMElement::$tagName in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 650
    [03-Jul-2018 20:32:14 UTC] PHP Notice:  Undefined property: DOMElement::$tagName in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 650
    [03-Jul-2018 20:32:14 UTC] PHP Fatal error:  Uncaught TypeError: Argument 2 passed to PHP_Typography\PHP_Typography::query_tags_to_ignore() must be an instance of DOMNode, null given, called in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/$Stack trace:
    #0 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php(159): PHP_Typography\PHP_Typography->query_tags_to_ignore(Object(DOMXPath), NULL, Object(PHP_Typography\Settings))
    #1 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php(103): PHP_Typography\PHP_Typography->process_textnodes('Body', Object(Closure), Object(PHP_Typography\Settings), true, Array)
    #2 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/includes/wp-typography/class-implementation.php(406): PHP_Typography\PHP_Typography->process('Body', Object(PHP_Typography\Settings), true, Array)
    #3 /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/includes/wp-typography/class-implementation.php(300): WP_Typography\Implementation->process('Body', true, false, Object(PHP_Typography\Settings))
    #4 /var/www/relativisticramblings.com/wp-includes/class-wp-hook.php(288): WP_Typography\Implementation->process_title('Body')
    #5 /var/www/relativisticramblings.com/wp-includes/plugin.php(203): WP_Hook->apply_filters('Body', Array)
    #6 /var/www/relativisticramblings.com/wp-includes/post-template.php(158): apply_filters('the_title', 'Body', 138)
    #7 /var/www/relativisticramblings.com/wp-content/plugins/easy-google-fonts/includes/class-egf-register-options.php(815): get_the_title()
    #8 /var/www/relativisticramblings.com/wp-includes/class-wp-hook.php(286): EGF_Register_Options->get_custom_option_parameters(Array)
    #9 /var/www/relativisticramblings.com/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array)
    #10 /var/www/relativisticramblings.com/wp-content/plugins/easy-google-fonts/includes/class-egf-register-options.php(746): apply_filters('tt_font_get_opt...', Array)
    #11 /var/www/relativisticramblings.com/wp-content/plugins/easy-google-fonts/includes/class-egf-register-options.php(859): EGF_Register_Options::get_option_parameters()
    #12 /var/www/relativisticramblings.com/wp-content/plugins/easy-google-fonts/includes/class-egf-register-options.php(907): EGF_Register_Options::get_option_defaults()
    #13 /var/www/relativisticramblings.com/wp-content/plugins/easy-google-fonts/includes/class-egf-frontend.php(131): EGF_Register_Options::get_options(true)
    #14 /var/www/relativisticramblings.com/wp-includes/class-wp-hook.php(286): EGF_Frontend->enqueue_stylesheets('')
    #15 /var/www/relativisticramblings.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #16 /var/www/relativisticramblings.com/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #17 /var/www/relativisticramblings.com/wp-includes/script-loader.php(1447): do_action('wp_enqueue_scri...')
    #18 /var/www/relativisticramblings.com/wp-includes/class-wp-hook.php(286): wp_enqueue_scripts('')
    #19 /var/www/relativisticramblings.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #20 /var/www/relativisticramblings.com/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #21 /var/www/relativisticramblings.com/wp-includes/general-template.php(2614): do_action('wp_head')
    #22 /var/www/relativisticramblings.com/wp-content/themes/twentysixteen/header.php(21): wp_head()
    #23 /var/www/relativisticramblings.com/wp-includes/template.php(688): require_once('/var/www/relati...')
    #24 /var/www/relativisticramblings.com/wp-includes/template.php(647): load_template('/var/www/relati...', true)
    #25 /var/www/relativisticramblings.com/wp-includes/general-template.php(41): locate_template(Array, true)
    #26 /var/www/relativisticramblings.com/wp-content/themes/twentysixteen/index.php(17): get_header()
    #27 /var/www/relativisticramblings.com/wp-includes/template-loader.php(74): include('/var/www/relati...')
    #28 /var/www/relativisticramblings.com/wp-blog-header.php(19): require_once('/var/www/relati...')
    #29 /var/www/relativisticramblings.com/index.php(21): require('/var/www/relati...')
    #30 {main}
      thrown in /var/www/relativisticramblings.com/wp-content/plugins/wp-typography/vendor/mundschenk-at/php-typography/src/class-php-typography.php on line 282
    Plugin Author pepe

    (@pputzer)

    Please check your PHP ini files that extension=dom.so is not included twice. Also, the libxml extension is activated too, right?

    Thread Starter cmeeren

    (@cmeeren)

    I have now verified that extension=dom.so only appears once, and I have also added extension=libxml.so (which was not there before). I still get the same exception.

    Also, the exception does not occur if the plugin is disabled. That simply seemed to be caused by caching; a few minutes after disabling the plugin, the site works.

    Plugin Author pepe

    (@pputzer)

    Was there a time when wp-Typography worked correctly on your new server? Is the title of the page “Body”?

    Thread Starter cmeeren

    (@cmeeren)

    No, wp-typography never worked after the OS upgrade. Body is not the title of the page. Here’s the page (though all subpages also stop working if I enable wp-typography).

    Plugin Author pepe

    (@pputzer)

    Have you got any idea where that Body comes from? It’s a string that’s processed as a title (the_title filter hook), might be from a widget or some other small part of the page, but I could not find it there.

    Thread Starter cmeeren

    (@cmeeren)

    Sorry, I have no idea. A quick grep -rnw '/path/to/relativisticramblings.com/' -e 'Body' did not turn up anything that I’d consider relevant. Perhaps it’s a string in the DB.

    • This reply was modified 6 years, 8 months ago by cmeeren.
Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Class ‘DOMImplementation’ not found’ is closed to new replies.