No Code Attached Yet Information Required
avatar mikeprince
mikeprince
15 Apr 2026

Description

A TypeError is thrown by plg_system_debug on every redirect-based action (such as administrator login and logout) in Joomla 6.1.0.

Exception

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

Root cause

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.

Expected behaviour

The Debug plugin should guard against a null $queryMonitor before instantiating QueryCollector, either skipping the collector silently or initialising the monitor if appropriate.

Suggested fix

phpif ($queryMonitor !== null) {
$this->debugBar->addCollector(
new QueryCollector($this->db, $queryMonitor)
);
}

Steps to reproduce

Enable the System - Debug plugin
Log in or log out of the Joomla administrator backend
Exception is thrown on every such action

Environment

Joomla 6.1.0
PHP 8.4

avatar mikeprince mikeprince - open - 15 Apr 2026
avatar mikeprince mikeprince - change - 15 Apr 2026
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 15 Apr 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Apr 2026
avatar Fedik
Fedik - comment - 15 Apr 2026

I cannot reproduce.
I enable Debug and Login/Logout still works.

is there any extra step?
Or maybe some extension installed?

avatar hiteshm0
hiteshm0 - comment - 15 Apr 2026

@mikeprince
#47601 tries to fix a very similar issue, can you test it for this issue aswell

avatar Fedik Fedik - change - 15 Apr 2026
Labels Added: Information Required
avatar Fedik Fedik - labeled - 15 Apr 2026
avatar mikeprince
mikeprince - comment - 15 Apr 2026

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

avatar mikeprince
mikeprince - comment - 15 Apr 2026

@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

avatar b2z
b2z - comment - 17 Apr 2026

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.

avatar joomdonation
joomdonation - comment - 17 Apr 2026
Image

Got same error today. Haven't had time to check to see why it happens yet.

avatar Cerbenix
Cerbenix - comment - 30 Sep 2026

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:

  1. services/provider.php registers the plugin with $container->lazy(), so on PHP 8.4+ the constructor only runs when a property is first accessed.
  2. On login, 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.
  3. 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.
  4. 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.

Add a Comment

Login with GitHub to post a comment