diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-20 07:47:44 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-20 07:47:44 +0000 |
commit | 339085eb13d748e1c1dd01af68b0d5903be8ca6f (patch) | |
tree | 8a935bf7c0a6fcb7815d79f86d97362871900334 /includes/actions.inc | |
parent | 7cf7f998781c24f0f27218a9ffdcde290e7ec6ec (diff) | |
download | brdo-339085eb13d748e1c1dd01af68b0d5903be8ca6f.tar.gz brdo-339085eb13d748e1c1dd01af68b0d5903be8ca6f.tar.bz2 |
- Patch #306611 by jbomb, sun | Damien Tournoud: fixed fatal error when trying to invoke non-existing action callbacks.
Diffstat (limited to 'includes/actions.inc')
-rw-r--r-- | includes/actions.inc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/includes/actions.inc b/includes/actions.inc index 65089b6ac..3ef5b848a 100644 --- a/includes/actions.inc +++ b/includes/actions.inc @@ -77,8 +77,13 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a // Configurable actions need parameters. if (is_numeric($action_id)) { $function = $params['callback']; - $context = array_merge($context, $params); - $actions_result[$action_id] = $function($object, $context, $a1, $a2); + if (function_exists($function)) { + $context = array_merge($context, $params); + $actions_result[$action_id] = $function($object, $context, $a1, $a2); + } + else { + $actions_result[$action_id] = FALSE; + } } // Singleton action; $action_id is the function name. else { @@ -92,8 +97,13 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a if (is_numeric($action_ids)) { $action = db_query("SELECT callback, parameters FROM {actions} WHERE aid = :aid", array(':aid' => $action_ids))->fetchObject(); $function = $action->callback; - $context = array_merge($context, unserialize($action->parameters)); - $actions_result[$action_ids] = $function($object, $context, $a1, $a2); + if (function_exists($function)) { + $context = array_merge($context, unserialize($action->parameters)); + $actions_result[$action_ids] = $function($object, $context, $a1, $a2); + } + else { + $actions_result[$action_ids] = FALSE; + } } // Singleton action; $action_ids is the function name. else { |