From: Brad Jorsch Date: Wed, 28 Nov 2018 15:23:12 +0000 (-0500) Subject: Message: Don't include Title objects in the serialization (part 1) X-Git-Tag: 1.34.0-rc.0~3400^2 X-Git-Url: http://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=508ee26e5e8661a0035639d4b405588f451665a4;p=lhc%2Fweb%2Fwiklou.git Message: Don't include Title objects in the serialization (part 1) Stringify the title instead. This will help avoid running into the PHP/HHVM serialization incompatibility described in T210528. This is part 1: start stringifying and using the string, but continue storing the Title object for the benefit of mixed environments where some servers still only handle a Title object. Bug: T210528 Change-Id: I07aac3aab2d4e27a7203f4e4fb3ce1b5d86c517c --- diff --git a/includes/Message.php b/includes/Message.php index 3bd775537f..f9d1cce206 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -290,6 +290,7 @@ class Message implements MessageSpecifier, Serializable { 'format' => $this->format, 'useDatabase' => $this->useDatabase, 'title' => $this->title, + 'titlestr' => $this->title ? $this->title->getFullText() : null, ] ); } @@ -307,7 +308,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 + } } /**