No Code Attached Yet Information Required bug
avatar hikashop-nicolas
hikashop-nicolas
20 Mar 2024

Steps to reproduce the issue

That's complex. We were not able to reproduce the issue on our local test websites. We are able to reproduce the issue on the website of the user.
The user who reported the issue is using both EasySocial and HikaShop on the same J5 website.
The error happens when he tries to delete a video in EasySocial and the HikaShop finder plugin is enabled.

Expected result

EasySocial video is deleted successfully.

Actual result

Error is displayed: plgFinderHikashopBridge::onFinderAfterDelete(): Argument #1 ($event) must be of type Joomla\CMS\Event\Finder\AfterDeleteEvent, Joomla\Event\Event given, called in /home/orajintv/public_html/libraries/vendor/joomla/event/src/Dispatcher.php on line 454

System information (as much as possible)

Joomla 5.0.3
HikaShop 5.0.3 (latest)
EasySocial 4.0.14 (latest)

Additional comments

This is the only user reporting the issue so far. The HikaShop finder plugin works fine normally on Joomla 3, Joomla 4 and Joomla 5.

Searching about this issue on internet I found this issue #42617 which seems similar albeit different.

The onFinderAfterDelete is defined like this in the cod of the HikaShop finder plugin for Joomla 5:
public function onFinderAfterDelete(FinderEvent\AfterDeleteEvent $event) {
return $this->_onFinderAfterDelete($event->getContext(), $event->getItem());
}

The onFinderAfterDelete method of the plugins/finder/content/src/Extension/Content.php file also uses the same method definition:
onFinderAfterDelete(FinderEvent\AfterDeleteEvent $event)
https://github.com/joomla/joomla-cms/blob/5.0-dev/plugins/finder/content/src/Extension/Content.php

The user reports that it had the same error with the content finder plugin and that he modified the file /plugins/finder/content/src/Extension/Content.php on his website with the code from Joomla 4 and it "fixed" the problem. I checked and I can see the code of the Joomla 4 Content.php file in the file on his website.
So I believe there is something else on his website which creates that problem and these errors with onFinderAfterDelete are just a consequence of that.

Of course, I could tell him to just replace the code for Joomla 5 with the code for Joomla 4 in the HikaShop finder plugin and it would "fix" the problem, but it's not a long term solution for him, and if that user got the error, others will probably have it too in the future.
However, I don't know where the problem could be, so I'm posting here hoping someone better versed in the finder system and events has some ideas.

avatar hikashop-nicolas hikashop-nicolas - open - 20 Mar 2024
avatar joomla-cms-bot joomla-cms-bot - change - 20 Mar 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Mar 2024
avatar alikon
alikon - comment - 20 Mar 2024

please shorten the title ?

avatar hikashop-nicolas hikashop-nicolas - change - 20 Mar 2024
Title
plgFinderHikashopBridge::onFinderAfterDelete(): Argument #1 ($event) must be of type Joomla\CMS\Event\Finder\AfterDeleteEvent, Joomla\Event\Event given, called in /home/orajintv/public_html/libraries/vendor/joomla/event/src/Dispatcher.php on line 454
onFinderAfterDelete(): Argument #1 ($event) must be of type Joomla\CMS\Event\Finder\AfterDeleteEvent, Joomla\Event\Event given
avatar hikashop-nicolas hikashop-nicolas - edited - 20 Mar 2024
avatar Hackwar
Hackwar - comment - 22 Mar 2024

Looking at this and also on the code of hikashop (I'm actually a customer for one of my customers. ? ) I can't see anything wrong with that. I would actually rather say that the user has a seriously botched system update. My assumption is that during the update larger parts of the files were not properly replaced with the new versions, resulting in the event being triggered with the old J4 code. Can you check if the Joomla core files are actually the right ones from Joomla 5.0?

avatar Hackwar Hackwar - change - 22 Mar 2024
Labels Added: Information Required
avatar Hackwar Hackwar - labeled - 22 Mar 2024
avatar hikashop-nicolas
hikashop-nicolas - comment - 22 Mar 2024

Thanks for your answer. Which file(s) should I look at ? I looked a bit around but I didn't find anything.
/libraries/src/Event/Finder/AfterDeleteEvent.php or /libraries/src/Event/CoreEventAware.php look fine.
I do see the line:
'onFinderAfterDelete' => Finder\AfterDeleteEvent::class,
in the /libraries/src/Event/CoreEventAware.php file. If I'm not correct, it should be this which is responsible to get the correct event class based on the event being trigged the old fashion way.
The trigger call in EasySocial looks fine too. It uses the old style code :
$app->triggerEvent('onAfterDeleteEvent', array(...));

avatar Hackwar
Hackwar - comment - 23 Mar 2024

The files you want to look at are everything in /administrator/components/com_finder

avatar Fedik
Fedik - comment - 23 Mar 2024

The error happens when he tries to delete a video in EasySocial

That the answer.

The trigger call in EasySocial looks fine too. $app->triggerEvent('onAfterDeleteEvent' ..

That not where it is trigered.
Look for EasySocial plugin wich trigger onFinderAfterDelete event.

I do not have access to their code, so cannot say more.
but the error comes from their side.

avatar Hackwar Hackwar - change - 24 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 24 Mar 2024
avatar DerekBuntin
DerekBuntin - comment - 28 Mar 2024

Thanks for your answer. Which file(s) should I look at ? I looked a bit around but I didn't find anything. /libraries/src/Event/Finder/AfterDeleteEvent.php or /libraries/src/Event/CoreEventAware.php look fine. I do see the line: 'onFinderAfterDelete' => Finder\AfterDeleteEvent::class, in the /libraries/src/Event/CoreEventAware.php file. If I'm not correct, it should be this which is responsible to get the correct event class based on the event being trigged the old fashion way. The trigger call in EasySocial looks fine too. It uses the old style code : $app->triggerEvent('onAfterDeleteEvent', array(...));

Hi Nicolas,

As I mentioned previously, the Joomla core file 'plugins/finder/content/src/extension/content.php' also had the same problem when they had code like yours, the 'new code', this was after upgrading it via admin from 3x to 5x. When the hikashop finder plugin was switched off, that also had the same problem. After updating the core finder plugin (content.php) I noticed the code had resorted back to the old style and worked fine.

The issue, as you know still exists with the hikashop plugin. We have reached out to EasySocial and as you can imagine they also said the issue lies with the hikashop plugin.

As you suggested above, I have updated all core files by downloading the latest Joomla version 5.0.3x and overwriting all core files, this should resolve any conflicting issues with the upgrade from 3x to 5x.

I'll ask the client to test the deletion of the videos and get back to you shortly.

avatar hikashop-nicolas
hikashop-nicolas - comment - 28 Mar 2024

@DerekBuntin : I think the answer from EasySocial is wrong. If the problem was with the HikaShop plugin, then how come you have the same issue with the content plugin of Joomla ? You should not have to modify the content plugin of Joomla.

@Fedik : I looked in the files of EasySocial and file the line:
ESDispatcher::trigger('onFinderAfterDelete', array('easysocial.videos', $this->table));
in the file administrator/components/com_easysocial/includes/video/video.php
It looks normal to me.
The trigger function is defined like this: https://i.imgur.com/3Q5HjO0.png
It looks fine to me. Any ideas ?

avatar Fedik
Fedik - comment - 28 Mar 2024

idk, on quick look it looks bad to me, mix of everything. They checking for J4, for code for J5.
However it need to debug a "full stack", maybe it somewhere else, something missing.

It somehow bypass our backward compatibility layer, and picking a generic Joomla\Event\Event class.

avatar Hackwar
Hackwar - comment - 28 Mar 2024

Is that ED::isJoomla4 checking on version == 4 or version > 3?

avatar DerekBuntin
DerekBuntin - comment - 28 Mar 2024

@DerekBuntin : I think the answer from EasySocial is wrong. If the problem was with the HikaShop plugin, then how come you have the same issue with the content plugin of Joomla ? You should not have to modify the content plugin of Joomla.

@Fedik : I looked in the files of EasySocial and file the line: ESDispatcher::trigger('onFinderAfterDelete', array('easysocial.videos', $this->table)); in the file administrator/components/com_easysocial/includes/video/video.php It looks normal to me. The trigger function is defined like this: https://i.imgur.com/3Q5HjO0.png It looks fine to me. Any ideas ?

After overwriting all core files we still see the issue:

plgFinderHikashopBridge::onFinderAfterDelete(): Argument #1 ($event) must be of type Joomla\CMS\Event\Finder\AfterDeleteEvent, Joomla\Event\Event given, called in /Users/derekbuntin/Websites/orajin/libraries/vendor/joomla/event/src/Dispatcher.php on line 454

1 | () | JROOT/plugins/finder/hikashop/hikashop_j5.php:52
2 | plgFinderHikashopBridge->onFinderAfterDelete() | JROOT/libraries/vendor/joomla/event/src/Dispatcher.php:454
3 | Joomla\Event\Dispatcher->dispatch() | JROOT/administrator/components/com_easysocial/includes/compatibility.php:783
4 | ESDispatcher::trigger() | JROOT/administrator/components/com_easysocial/includes/video/video.php:2674
5 | SocialVideo->delete() | JROOT/components/com_easysocial/controllers/videos.php:186
6 | EasySocialControllerVideos->delete() | JROOT/libraries/src/MVC/Controller/BaseController.php:730
7 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT/components/com_easysocial/controllers/controller.php:67
8 | EasySocialController->execute() | JROOT/components/com_easysocial/easysocial.php:100
9 | require_once() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
10 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
11 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:361
12 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/SiteApplication.php:218
13 | Joomla\CMS\Application\SiteApplication->dispatch() | JROOT/libraries/src/Application/SiteApplication.php:261
14 | Joomla\CMS\Application\SiteApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:306
15 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/includes/app.php:58
16 | require_once() | JROOT/index.php:32
17 | require() | /xxx/.composer/vendor/laravel/valet/server.php:110

After switching off the hikashop plugin the content plugin is also experiencing the same issue:

Joomla\Plugin\Finder\Content\Extension\Content::onFinderAfterDelete(): Argument #1 ($event) must be of type Joomla\CMS\Event\Finder\AfterDeleteEvent, Joomla\Event\Event given, called in /Users/derekbuntin/Websites/orajin/libraries/vendor/joomla/event/src/Dispatcher.php on line 454

1 | () | JROOT/plugins/finder/content/src/Extension/Content.php:145
2 | Joomla\Plugin\Finder\Content\Extension\Content->onFinderAfterDelete() | JROOT/libraries/vendor/joomla/event/src/Dispatcher.php:454
3 | Joomla\Event\Dispatcher->dispatch() | JROOT/administrator/components/com_easysocial/includes/compatibility.php:783
4 | ESDispatcher::trigger() | JROOT/administrator/components/com_easysocial/includes/video/video.php:2674
5 | SocialVideo->delete() | JROOT/components/com_easysocial/controllers/videos.php:186
6 | EasySocialControllerVideos->delete() | JROOT/libraries/src/MVC/Controller/BaseController.php:730
7 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT/components/com_easysocial/controllers/controller.php:67
8 | EasySocialController->execute() | JROOT/components/com_easysocial/easysocial.php:100
9 | require_once() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
10 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
11 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:361
12 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/SiteApplication.php:218
13 | Joomla\CMS\Application\SiteApplication->dispatch() | JROOT/libraries/src/Application/SiteApplication.php:261
14 | Joomla\CMS\Application\SiteApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:306
15 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/includes/app.php:58
16 | require_once() | JROOT/index.php:32
17 | require() | /xxx/.composer/vendor/laravel/valet/server.php:110

I'll ask EasySocial to have another look at this.

avatar Fedik
Fedik - comment - 28 Mar 2024

@DerekBuntin thanks for the trace. It confirms that the bug is in EasySocial ESDispatcher::trigger()

avatar Hackwar Hackwar - close - 28 Mar 2024
avatar Hackwar
Hackwar - comment - 28 Mar 2024

Ok, so I'm closing this issue, since it is a third party issue.

avatar Hackwar Hackwar - change - 28 Mar 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-03-28 20:28:29
Closed_By Hackwar

Add a Comment

Login with GitHub to post a comment