• Resolved Stefan

    (@stufu07)


    Just tried to install Query monitor on a site together with this plugin https://wordpress.org/plugins/tangible-loops-and-logic/ , but for some reason i get a fatal error as soon as both of the plugins are activated. Despite the fatal error, both plugins remain activated, but cause the same fatal error again as soon as one of the plugins gets deactivates. This is the error message:

    Fatal error: Uncaught Error: preg_split(): Argument #2 ($subject) must be of type string, int given /wp-content/plugins/query-monitor/classes/Hook.php on line 65

    When both plugins are activated, query monitor doesn’t work and i get the following error message in the console:

    QM error from JS: QM output does not exist

    Do you have any ideas what could cause this problem?

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

    (@johnbillion)

    WordPress Core Developer

    Thanks for the report! The cause here is the Tangible Loops and Logic plugin is triggering an action with an invalid hook name. The hook name appears to be boolean false, which internally gets converted to integer zero by the WordPress hook system, and this is what gets passed onto QM and causes the fatal error. A hook name must be a string, and anything such as boolean false is not going to work and needs to be fixed.

    You should report this to the developers of the Loops and Logic plugin. The problematic code is here: https://plugins.trac.wordpress.org/browser/tangible-loops-and-logic/tags/3.1.1/vendor/tangible/plugin-framework/tangible-module.php?marks=173#L173 . The value of $this->ready at this point is boolean false.

    Thread Starter Stefan

    (@stufu07)

    Hi John, thanks for the quick and detailed support, I appreciate it. I informed the developers of Loops and Logic about the issue so they can take care of it.

    Just FYI that I got the same error in Query Monitor v.3.12.2. while doing some development debugging. The debug log contained:

    [11-May-2023 06:35:12 UTC] PHP Fatal error:  Uncaught TypeError: preg_split() expects parameter 2 to be string, int given in /srv/www/mytestsite/wp-content/plugins/query-monitor/classes/Hook.php:62
    Stack trace:
    #0 /srv/www/mytestsite/wp-content/plugins/query-monitor/classes/Hook.php(62): preg_split('#[_/.-]#', 0)

    I wonder whether a future version of Query Monitor could test to see if parameter 2 is a string, and log cases when it is not as “invalid hook” errors or similar?

    FYI this was fixed in L&L since version 3.1.2. Latest version is 3.2.9.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal error when used with the plugin “Loops and Logic”’ is closed to new replies.