Remove the throw from Message::extractParam()
authorKevin Israel <pleasestand@live.com>
Wed, 31 Oct 2012 20:59:50 +0000 (16:59 -0400)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 29 Nov 2012 22:33:57 +0000 (22:33 +0000)
Per Tim Starling's comment on bug 41400, I replaced the throw (when a
message parameter is invalid) with a call to trigger_error().

The string [INVALID] is used as a placeholder to make it clear from
the output that an error has occurred.

Change-Id: I974d55d44d392c956e7de6d243da9d8dc07d8833

includes/Message.php

index 5a4b810..abc7dc4 100644 (file)
@@ -606,7 +606,6 @@ class Message {
         * @since 1.18
         * @param $param String|Array: Parameter as defined in this class.
         * @return Tuple(type, value)
-        * @throws MWException
         */
        protected function extractParam( $param ) {
                if ( is_array( $param ) && isset( $param['raw'] ) ) {
@@ -618,7 +617,11 @@ class Message {
                } elseif ( !is_array( $param ) ) {
                        return array( 'before', $param );
                } else {
-                       throw new MWException( "Invalid message parameter: " . serialize( $param ) );
+                       trigger_error(
+                               "Invalid message parameter: " . htmlspecialchars( serialize( $param ) ),
+                               E_USER_WARNING
+                       );
+                       return array( 'before', '[INVALID]' );
                }
        }