• Hi. I love this plugin! It made me so sad when I discovered it was crashing WP. I suspect the real problem is with my code, but shouldn’t that show up in the stack trace? Here’s the error I receive:

    PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/staging.edenbooks.org/htdocs/wp-content/plugins/query-monitor/collectors/php_errors.php:206
    Stack trace:
    #0 /var/www/staging.edenbooks.org/htdocs/wp-content/plugins/query-monitor/collectors/php_errors.php(65): QM_Collector_PHP_Errors->output_fatal(‘Fatal error’, Array)
    #1 [internal function]: QM_Collector_PHP_Errors->exception_handler(Object(ParseError))
    #2 {main}
    thrown in /var/www/staging.edenbooks.org/htdocs/wp-content/plugins/query-monitor/collectors/php_errors.php on line 206

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Unfortunately due to PHP’s funky handling of errors there are some situations where you might not get a stack trace.

    The error handling in QM is quite ugly because it has to battle with every version of PHP back to 5.2, while simultaneously ensuring that various flavours of fatal errors, throwables, and exceptions do not get hidden, working around the WSOD protection in WordPress core, ensuring that the default error handler (eg. the error logger in PHP) still works, loading early enough to catch all errors, and more.

    That said, I’m not sure what might prevent the stack trace from appearing in this situation.

    Which version of PHP are you using? It looks like 7.x because it’s being caught by the exception handler.

    Thread Starter scott8035

    (@scott8035)

    It’s currently at 7.3. If you think it might help I could switch to 7.4.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    I don’t think it would help, to be honest.

    I’ll do some testing locally to see if I can reproduce the problem when there’s a parse error.

    Did you figure out the root cause of the error? It looks like you were trying to instantiate a class with a name that isn’t a string.

    Thread Starter scott8035

    (@scott8035)

    The root cause was a missing semi-colon before a closing brace in some code I’m writing for a plugin. The missing classname was an error within the QM collector as I recall.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Alright cheers, I’ll do some testing and see if I can persuade that stack trace to appear.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Ah-ha! This might actually be a bug in QM. If a fatal error occurs before QM has registered its dispatchers then that fatal in query-monitor/collectors/php_errors.php:206 would occur.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Query monitor causes fatal PHP error with no indication why’ is closed to new replies.