CiviEventDispatcher - Fix pass-by-reference of hook-style arguments for service-based...
authorTim Otten <totten@civicrm.org>
Tue, 16 Aug 2022 04:53:34 +0000 (21:53 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 17 Aug 2022 02:16:29 +0000 (19:16 -0700)
commitb4e1d12ec64332fd128c876e62510d87d36d5e84
tree72508d34eb7ec80f1e2fbbe1a1012b2e54da3a0c
parentaa0195698f8d5b4a62abf081a3b860814279f9b4
CiviEventDispatcher - Fix pass-by-reference of hook-style arguments for service-based listeners

Suppose you are firing `hook_civicrm_foo` to a serivce-based listener
taht uses hook-style arguments. Conceptually, this is a call like:

Civi::service('foo')->hook_civicrm_foo($arg1, &$arg2, $arg3);

Before this patch, all values are pass-by-value. Changes to `&$arg2`
are not propagated back out.

The patch ensures that `&$arg2` propagates back out.
Civi/Core/CiviEventDispatcher.php
Civi/Core/Event/HookStyleServiceListener.php [new file with mode: 0644]
Civi/Core/Event/ServiceListener.php