Skip to content

Commit c189551

Browse files
authored
[4.4] Backward compatibility handling for plugins that setting the result directly (#41525)
* Backward compatibility handling for plugins that setting the result directly. * Update libraries/src/Event/AbstractImmutableEvent.php Co-authored-by: Brian Teeman <[email protected]> ---------
1 parent 3ea52a7 commit c189551

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libraries/src/Event/AbstractImmutableEvent.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ public function __construct(string $name, array $arguments = [])
6464
*/
6565
public function offsetSet($name, $value)
6666
{
67+
// B/C check for plugins which use $event['result'] = $result;
68+
if ($name === 'result') {
69+
parent::offsetSet($name, $value);
70+
71+
@trigger_error(
72+
'Setting a result in an immutable event is deprecated, and will not work in Joomla 6. Event ' . $this->getName(),
73+
E_USER_DEPRECATED
74+
);
75+
76+
return;
77+
}
78+
6779
throw new \BadMethodCallException(
6880
sprintf(
6981
'Cannot set the argument %s of the immutable event %s.',

0 commit comments

Comments
 (0)