A TypeError is thrown by plg_system_debug on every redirect-based action (such as administrator login and logout) in Joomla 6.1.0.
TypeError: Joomla\Plugin\System\Debug\DataCollector\QueryCollector::__construct():
Argument #2 ($queryMonitor) must be of type Joomla\Database\Monitor\DebugMonitor,
null given, called in .../plugins/system/debug/src/Extension/Debug.php on line 323
In plugins/system/debug/src/Extension/Debug.php at line 323, QueryCollector is instantiated without first checking whether $queryMonitor is null. When a redirect fires (e.g. after login/logout), the database monitor has not been initialised, resulting in the type error.
The Debug plugin should guard against a null $queryMonitor before instantiating QueryCollector, either skipping the collector silently or initialising the monitor if appropriate.
phpif ($queryMonitor !== null) {
$this->debugBar->addCollector(
new QueryCollector($this->db, $queryMonitor)
);
}
Enable the System - Debug plugin
Log in or log out of the Joomla administrator backend
Exception is thrown on every such action
Joomla 6.1.0
PHP 8.4
| Labels |
Removed:
?
|
||
| Labels |
Added:
No Code Attached Yet
|
||
@mikeprince
#47601 tries to fix a very similar issue, can you test it for this issue aswell
| Labels |
Added:
Information Required
|
||
Or maybe some extension installed?
I have Admin Tools installed so get the exception by email, but it should still be generated if Debug is on.
There is no major problem: login and logout still work fine
@mikeprince #47601 tries to fix a very similar issue, can you test it for this issue aswell
I couldn't reproduce that issue in the same environment
I've got the same error on all site pages after update to 6.1.0. But after few refreshes of the page the error is gone. Login and logout works fine for me.
Reproduced on Joomla 6.1.3 / PHP 8.5 with session_handler = database, on the redirect after login.
The monitor gets nulled before the constructor runs, because of the lazy proxy:
services/provider.php registers the plugin with $container->lazy(), so on PHP 8.4+ the constructor only runs when a property is first accessed.Session::fork() → session_regenerate_id() closes the session. DatabaseHandler::close() calls $db->disconnect(), which fires onAfterDisconnect, and that is the first event the plugin receives on this request.onAfterDisconnect runs on the uninitialised proxy: method calls don't initialise a lazy proxy, only property access does. It calls $db->setMonitor(null) first, and only then reads $this->params, which runs the real constructor, and that constructor captures getMonitor(), which is now null.onAfterRespond passes that null to QueryCollector, causing the TypeError.Possible fixes: drop lazy() for the debug plugin (its constructor has side effects), or access a property / capture the monitor before setMonitor(null) in onAfterDisconnect. A null-check before new QueryCollector would only hide the problem.
I cannot reproduce.
I enable Debug and Login/Logout still works.
is there any extra step?
Or maybe some extension installed?