diff options
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r-- | includes/bootstrap.inc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 994763fb3..adece9912 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -709,6 +709,11 @@ function drupal_set_message($message = NULL, $type = 'status') { * (optional) Only return messages of this type. * @param $clear_queue * (optional) Set to FALSE if you do not want to clear the messages queue + * @return + * An associative array, the key is the message type, the value an array + * of messages. If the $type parameter is passed, you get only that type, + * or an empty array if there are no such messages. If $type is not passed, + * all message types are returned, or an empty array if none exist. */ function drupal_get_messages($type = NULL, $clear_queue = TRUE) { if ($messages = drupal_set_message()) { @@ -716,7 +721,9 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) { if ($clear_queue) { unset($_SESSION['messages'][$type]); } - return array($type => $messages[$type]); + if (isset($messages[$type])) { + return array($type => $messages[$type]); + } } else { if ($clear_queue) { |