No Code Attached Yet bug
avatar HLeithner
HLeithner
24 Sep 2023

Steps to reproduce the issue

delete a user group

Expected result

group gone

Actual result

0 Joomla\CMS\Event\Model\ModelEvent::setContext(): Argument #1 ($value) must be of type string, array given, called in /web/darmplus.verlauf.at/libraries/src/Event/AbstractEvent.php on line 205

Call stack
--
# | Function | Location
1 | () | JROOT/libraries/src/Event/Model/ModelEvent.php:75
2 | Joomla\CMS\Event\Model\ModelEvent->setContext() | JROOT/libraries/src/Event/AbstractEvent.php:205
3 | Joomla\CMS\Event\AbstractEvent->setArgument() | JROOT/libraries/src/Event/AbstractEvent.php:115
4 | Joomla\CMS\Event\AbstractEvent->__construct() | JROOT/libraries/src/Event/AbstractImmutableEvent.php:51
5 | Joomla\CMS\Event\AbstractImmutableEvent->__construct() | JROOT/libraries/src/Event/Model/ModelEvent.php:55
6 | Joomla\CMS\Event\Model\ModelEvent->__construct() | JROOT/libraries/src/Application/EventAware.php:106
7 | Joomla\CMS\Application\WebApplication->triggerEvent() | JROOT/administrator/components/com_users/src/Model/GroupModel.php:282
8 | Joomla\Component\Users\Administrator\Model\GroupModel->delete() | JROOT/libraries/src/MVC/Controller/AdminController.php:152
9 | Joomla\CMS\MVC\Controller\AdminController->delete() | JROOT/administrator/components/com_users/src/Controller/GroupsController.php:65
10 | Joomla\Component\Users\Administrator\Controller\GroupsController->delete() | JROOT/libraries/src/MVC/Controller/BaseController.php:730
11 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
12 | Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:361
13 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/AdministratorApplication.php:150
14 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT/libraries/src/Application/AdministratorApplication.php:195
15 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:306
16 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/administrator/includes/app.php:58
17 | require_once() | JROOT/administrator/index.php:32
18 | require_once() | JROOT/public/administrator/index.php:16

System information (as much as possible)

5.0.0-beta2

Additional comments

avatar HLeithner HLeithner - open - 24 Sep 2023
avatar joomla-cms-bot joomla-cms-bot - change - 24 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Sep 2023
avatar HLeithner HLeithner - change - 24 Sep 2023
Labels Added: Release Blocker bug
avatar HLeithner HLeithner - labeled - 24 Sep 2023
avatar HLeithner HLeithner - labeled - 24 Sep 2023
avatar heelc29
heelc29 - comment - 24 Sep 2023

Something with the event mapping is wrong:

'onUserBeforeDeleteGroup' => Model\BeforeDeleteEvent::class,
'onUserAfterDeleteGroup' => Model\AfterDeleteEvent::class,

User\xxxDeleteEvent will work, but I'm not sure if this is the "right" event ...


Factory::getApplication()->triggerEvent($this->event_before_delete, [$table->getProperties()]);

Factory::getApplication()->triggerEvent($this->event_after_delete, [$table->getProperties(), true, $this->getError()]);

avatar Fedik
Fedik - comment - 25 Sep 2023

hm, this 2 events does not follow the parent implementation of delete() events:

$beforeDeleteEvent = new Model\BeforeDeleteEvent($this->event_before_delete, [
'context' => $context,
'subject' => $table,
]);

Almost all Model events requires context value, but here it is missing.
Addittionaly the subject argument required to be a Table object or object, but here it is an array.

avatar HLeithner
HLeithner - comment - 25 Sep 2023

better to normalize it now?

avatar Fedik
Fedik - comment - 25 Sep 2023

it probably will be need own event class, because onUserAfterDeleteGroup

Factory::getApplication()->triggerEvent($this->event_after_delete, [$table->getProperties(), true, $this->getError()]);

Is very different from model onAfterDelete. It more like a copy/paste of onUserDeleteEvent, which have nothing to do with UserGroup.

The issue, that it wil make an incosistency, because onUserBeforeSaveGroup and onUserAfterSaveGroup is perfectly fit in to Model events,

avatar Fedik Fedik - change - 25 Sep 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-09-25 09:55:22
Closed_By Fedik
avatar Fedik Fedik - close - 25 Sep 2023
avatar Fedik
Fedik - comment - 25 Sep 2023

Please test #41916

avatar richard67 richard67 - change - 25 Sep 2023
Labels Removed: Release Blocker
avatar richard67 richard67 - unlabeled - 25 Sep 2023

Add a Comment

Login with GitHub to post a comment