X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FStatus.php;h=77bf4a859224f0f0ecf84427e467f91e56823574;hb=26fcab1f18c568a41bf4b25d86067434593a87cb;hp=0244c8ae0240bb139ebbea54ad32346c1e349d4a;hpb=0e675650aed26a742a9c2173d9469647a9f42bcc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Status.php b/includes/Status.php index 0244c8ae02..77bf4a8592 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -405,15 +405,20 @@ class Status { /** * Returns true if the specified message is present as a warning or error * - * Note, due to the lack of tools for comparing Message objects, this - * function will not work when using a Message object as a parameter. + * @param string|Message $message Message key or object to search for * - * @param string $msg Message name * @return bool */ - public function hasMessage( $msg ) { + public function hasMessage( $message ) { + if ( $message instanceof Message ) { + $message = $message->getKey(); + } foreach ( $this->errors as $error ) { - if ( $error['message'] === $msg ) { + if ( $error['message'] instanceof Message + && $error['message']->getKey() === $message + ) { + return true; + } elseif ( $error['message'] === $message ) { return true; } }