User tests: Successful: Unsuccessful:
Restore array referencing for arguments that was referenced in past. Instead of ArrayProxy.
This applies only for legacy event listeners.
New event listeners should explicitly call $event->updateFoobar($value)
to update the argument (only for arguments that expected to be modified).
@HLeithner @wilsonge please review
All should work as before.
Works
Works
Please select:
Category | ⇒ | Administration com_menus Modules Front End com_contact Libraries |
Status | New | ⇒ | Pending |
Title |
|
Labels |
Added:
PR-5.0-dev
|
Title |
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-09-17 17:26:56 |
Closed_By | ⇒ | HLeithner | |
Labels |
Added:
Feature
bug
|
A bit late to the party. But there is still a bit of an issue in the ModuleHelper::load
method (libraries/src/Helper/ModuleHelper.php
).
It Joomla 4 it initially passes the $modules
object to the onPrepareModuleList
event as null
.
This way plugins can see the difference between an unset or an empty module list.
In Joomla 5 however, it is initially set to an empty array. So plugins can no longer tell the difference.
That difference is important!
Say you have 2 plugins that do something on onPrepareModuleList
.
Plugin 1 checks stuff and decides the module list should be empty (= no modules should be rendered).
Plugin 2 sees an empty array and says: "Ok, another plugin already decided there are no modules. So we don't have to do anything.
Or:
Plugin 1 checks stuff and decides it should not do anything. So it leaves the $modules
as it is (null
)
Plugin 2 sees the null
value and says: "Ok, we are first to the party. Lets grab the modules we want to push into the $modules
list.
Again: no longer possible in Joomla 5.
So now a second plugin would have to override the empty array module list even if a previous module purposely set it that way.
So can the $modules = [];
be changed back to $modules = null;
in the ModuleHelper::load
method?
@regularlabs better to create a new issue. Not many people look at closed ones
thanks, can you do me a favor and add this to the migration documentation with a big note that all events (listed one by one) having references are getting changed in 6.0 and developer need to support the new syntax?