Merge "resourceloader: Simplify isCompatible() parameter in startup.js"
[lhc/web/wiklou.git] / includes / Message.php
index f9d1cce..0b3113f 100644 (file)
@@ -289,7 +289,6 @@ class Message implements MessageSpecifier, Serializable {
                        'parameters' => $this->parameters,
                        'format' => $this->format,
                        'useDatabase' => $this->useDatabase,
-                       'title' => $this->title,
                        'titlestr' => $this->title ? $this->title->getFullText() : null,
                ] );
        }
@@ -301,6 +300,10 @@ class Message implements MessageSpecifier, Serializable {
         */
        public function unserialize( $serialized ) {
                $data = unserialize( $serialized );
+               if ( !is_array( $data ) ) {
+                       throw new InvalidArgumentException( __METHOD__ . ': Invalid serialized data' );
+               }
+
                $this->interface = $data['interface'];
                $this->key = $data['key'];
                $this->keysToTry = $data['keysToTry'];
@@ -1160,14 +1163,11 @@ class Message implements MessageSpecifier, Serializable {
                                        // escaped, breaking the replacement and avoiding XSS.
                                        $replacementKeys['$' . ( $n + 1 )] = $marker . ( $n + 1 );
                                }
-                       } else {
-                               if ( $paramType === 'after' ) {
-                                       $replacementKeys[$marker . ( $n + 1 )] = $value;
-                               }
+                       } elseif ( $paramType === 'after' ) {
+                               $replacementKeys[$marker . ( $n + 1 )] = $value;
                        }
                }
-               $message = strtr( $message, $replacementKeys );
-               return $message;
+               return strtr( $message, $replacementKeys );
        }
 
        /**