From 8fd0fdbd54e17e176959592d9ee43e3b3ba60f97 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 4 Apr 2007 20:50:53 +0000 Subject: - Modified patch #133318 by hunmonk: drupal_get_messages() returning incorrect array value. --- includes/bootstrap.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3