X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMessage.php;h=4049e114f39b3650a35a0a690745b2d68d3af9dc;hb=fcb138fc9528ba0393fc4b0295eeb0f30b1136dd;hp=3bd775537f523162de705726fcc4bd8556e11a04;hpb=74b2cfbe2411330e36f56f14864dc41fec9335f0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 3bd775537f..4049e114f3 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -289,7 +289,7 @@ class Message implements MessageSpecifier, Serializable { 'parameters' => $this->parameters, 'format' => $this->format, 'useDatabase' => $this->useDatabase, - 'title' => $this->title, + 'titlestr' => $this->title ? $this->title->getFullText() : null, ] ); } @@ -300,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']; @@ -307,7 +311,15 @@ class Message implements MessageSpecifier, Serializable { $this->format = $data['format']; $this->useDatabase = $data['useDatabase']; $this->language = $data['language'] ? Language::factory( $data['language'] ) : false; - $this->title = $data['title']; + + if ( isset( $data['titlestr'] ) ) { + $this->title = Title::newFromText( $data['titlestr'] ); + } elseif ( isset( $data['title'] ) && $data['title'] instanceof Title ) { + // Old serializations from before December 2018 + $this->title = $data['title']; + } else { + $this->title = null; // Explicit for sanity + } } /**