aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/notification.php
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2012-09-17 17:41:15 -0400
committerSteve Clay <steve@mrclay.org>2012-11-14 21:09:42 -0500
commit3048db0f3f1ade31d6f3a2cdd3268e978a3e3cf3 (patch)
tree1c21fd8f55bebeeedf4790aaa0e5e2f76e3a93eb /engine/lib/notification.php
parent7c6e3578ca8ab3e703852629e82b478265833d29 (diff)
downloadelgg-3048db0f3f1ade31d6f3a2cdd3268e978a3e3cf3.tar.gz
elgg-3048db0f3f1ade31d6f3a2cdd3268e978a3e3cf3.tar.bz2
Fixes #4861: allow lazy-loading for static method callbacks, allow more callables
Diffstat (limited to 'engine/lib/notification.php')
-rw-r--r--engine/lib/notification.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 18faff27f..9e3c075a8 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -38,7 +38,7 @@ $NOTIFICATION_HANDLERS = array();
function register_notification_handler($method, $handler, $params = NULL) {
global $NOTIFICATION_HANDLERS;
- if (is_callable($handler)) {
+ if (is_callable($handler, true)) {
$NOTIFICATION_HANDLERS[$method] = new stdClass;
$NOTIFICATION_HANDLERS[$method]->handler = $handler;
@@ -131,8 +131,9 @@ function notify_user($to, $from, $subject, $message, array $params = NULL, $meth
// Extract method details from list
$details = $NOTIFICATION_HANDLERS[$method];
$handler = $details->handler;
+ /* @var callable $handler */
- if ((!$NOTIFICATION_HANDLERS[$method]) || (!$handler)) {
+ if ((!$NOTIFICATION_HANDLERS[$method]) || (!$handler) || (!is_callable($handler))) {
error_log(elgg_echo('NotificationException:NoHandlerFound', array($method)));
}
@@ -140,7 +141,7 @@ function notify_user($to, $from, $subject, $message, array $params = NULL, $meth
// Trigger handler and retrieve result.
try {
- $result[$guid][$method] = $handler(
+ $result[$guid][$method] = call_user_func($handler,
$from ? get_entity($from) : NULL, // From entity
get_entity($guid), // To entity
$subject, // The subject