Skip to content
Snippets Groups Projects
Commit 339085eb authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #306611 by jbomb, sun | Damien Tournoud: fixed fatal error when trying...

- Patch #306611 by jbomb, sun | Damien Tournoud: fixed fatal error when trying to invoke non-existing action callbacks.
parent 7cf7f998
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment