Third party code (NOT Admin Tools) is calling the onUserAfterSave
Joomla event with no arguments, or the wrong argument count. In other words, this is a problem in third party code, not ours.
I can explain this with code, since I wrote Joomla's concrete events code myself a couple of years ago.
The \Joomla\CMS\Event\CoreEventAware
trait in the file libraries/src/Event/CoreEventAware.php
shows the mapping between event handlers and concrete event classes. The onUserAfterSave is mapped to the \Joomla\CMS\Event\User\AfterSaveEvent
class which lives in the libraries/src/Event/User/
AfterSaveEvent.php
file.
Towards the top of that file you see this:
protected $legacyArgumentsOrder = ['subject', 'isNew', 'savingResult', 'errorMessage'];
This gives you the argument count, their order, and their (canonical) names. As you can see, we have four arguments.
As you can see in our code (the \Akeeba\Plugin\System\AdminTools\Extension\AdminTools::onUserAfterSave
method in the system/admintools/src/Extension/AdminTools.php
file) we unwrap these arguments with this code:
[$user, $isnew, $success, $msg] = array_values($event->getArguments());
This unwrapping trick is something I invented during the Joomla! 5 beta period and is now also used in core Joomla! code thanks to the core maintainer Fedir Zinchuk who's converting all of Joomla's core code into concrete events. That is to say, unwrapping event arguments using PHP list unwrapping against array_values($event->getArguments())
is the canonical, official way of doing it.
Back to our code. As you can see, we unwrap four arguments in the same order and with the same meaning as what you saw in the \Joomla\CMS\Event\User\AfterSaveEvent
class. Note that the subject of the user events is always a user object, that's why I am using a variable named $user
; it has no functional role, but giving the variable name a semantic meaning makes it far less likely that I'll get confused and introduce bugs when consuming it.
Now let's look at the PHP warnings again. You get warnings about key 0 and key 1 in the list unwrapping. These are the first two mandatory arguments, subject
and isNew
. This means that something triggered Joomla's onUserAfterSave event without sending the user object and whether this is a new user. This is possible if someone triggered the event using the legacy code which is still supported but deprecated in Joomla! 5 (and which will cause a PHP fatal error in Joomla! 6). So, this is definitely a third party plugin messing up.
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!