bug: deleteFromPlatforms() uses deprecated triggerEvent() instead of Event dispatcher #228

Open
opened 2026-06-29 14:19:59 +00:00 by jmiller · 1 comment
Owner

Description

CrossPostDispatcher::deleteFromPlatforms() at line 601 uses the legacy Joomla 4 pattern to collect service plugins:

Factory::getApplication()->triggerEvent('onMokoSuiteCrossGetServices', [&$plugins]);

But the dispatch() method and QueueProcessor::getServicePluginMap() use the correct Joomla 5/6 Event-based pattern with ArrayAccess:

$event = new \Joomla\Event\Event('onMokoSuiteCrossGetServices', [$servicePlugins]);
Factory::getApplication()->getDispatcher()->dispatch('onMokoSuiteCrossGetServices', $event);
// Read plugins back from Event indices

The triggerEvent() method was deprecated in Joomla 4.2 and may not correctly pass by-reference arrays. In Joomla 6 this could cause deleteFromPlatforms() to find zero service plugins, making delete operations silently fail.

Fix

Replace lines 599-604 with the same Event-based pattern used in dispatch() and getServicePluginMap().

Impact

  • Severity: Medium -- delete operations may silently fail on Joomla 6
  • Affected file: source/packages/com_mokosuitecross/src/Helper/CrossPostDispatcher.php
  • Affected lines: 599-604
## Description `CrossPostDispatcher::deleteFromPlatforms()` at line 601 uses the legacy Joomla 4 pattern to collect service plugins: ```php Factory::getApplication()->triggerEvent('onMokoSuiteCrossGetServices', [&$plugins]); ``` But the `dispatch()` method and `QueueProcessor::getServicePluginMap()` use the correct Joomla 5/6 Event-based pattern with ArrayAccess: ```php $event = new \Joomla\Event\Event('onMokoSuiteCrossGetServices', [$servicePlugins]); Factory::getApplication()->getDispatcher()->dispatch('onMokoSuiteCrossGetServices', $event); // Read plugins back from Event indices ``` The `triggerEvent()` method was deprecated in Joomla 4.2 and may not correctly pass by-reference arrays. In Joomla 6 this could cause `deleteFromPlatforms()` to find zero service plugins, making delete operations silently fail. ## Fix Replace lines 599-604 with the same Event-based pattern used in `dispatch()` and `getServicePluginMap()`. ## Impact - **Severity**: Medium -- delete operations may silently fail on Joomla 6 - **Affected file**: `source/packages/com_mokosuitecross/src/Helper/CrossPostDispatcher.php` - **Affected lines**: 599-604
Author
Owner

Branch created: feature/228-bug-deletefromplatforms-uses-deprecated-

git fetch origin
git checkout feature/228-bug-deletefromplatforms-uses-deprecated-
Branch created: [`feature/228-bug-deletefromplatforms-uses-deprecated-`](https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteCross/src/branch/feature/228-bug-deletefromplatforms-uses-deprecated-) ```bash git fetch origin git checkout feature/228-bug-deletefromplatforms-uses-deprecated- ```
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteCross#228