Merge "build: Lower default Karma logLevel during local development"
[lhc/web/wiklou.git] / includes / parser / ParserOutput.php
index dbe609a..1922f7d 100644 (file)
@@ -213,11 +213,12 @@ class ParserOutput extends CacheTime {
        /** @var string[] */
        private static $speculativeFields = [
                'speculativePageIdUsed',
-               'speculativeRevIdUsed',
+               'mSpeculativeRevId',
                'revisionTimestampUsed'
        ];
+
        /** @var int|null Assumed rev ID for {{REVISIONID}} if no revision is set */
-       private $speculativeRevIdUsed;
+       private $mSpeculativeRevId;
        /** @var int|null Assumed page ID for {{PAGEID}} if no revision is set */
        private $speculativePageIdUsed;
        /** @var int|null Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set */
@@ -447,7 +448,7 @@ class ParserOutput extends CacheTime {
         * @since 1.28
         */
        public function setSpeculativeRevIdUsed( $id ) {
-               $this->speculativeRevIdUsed = $id;
+               $this->mSpeculativeRevId = $id;
        }
 
        /**
@@ -455,7 +456,7 @@ class ParserOutput extends CacheTime {
         * @since 1.28
         */
        public function getSpeculativeRevIdUsed() {
-               return $this->speculativeRevIdUsed;
+               return $this->mSpeculativeRevId;
        }
 
        /**
@@ -1325,9 +1326,18 @@ class ParserOutput extends CacheTime {
        }
 
        public function __sleep() {
-               return array_diff(
-                       array_keys( get_object_vars( $this ) ),
-                       [ 'mParseStartTime' ]
+               return array_filter( array_keys( get_object_vars( $this ) ),
+                       function ( $field ) {
+                               if ( $field === 'mParseStartTime' ) {
+                                       return false;
+                               } elseif ( strpos( $field, "\0" ) !== false ) {
+                                       // Unserializing unknown private fields in HHVM causes
+                                       // member variables with nulls in their names (T229366)
+                                       return false;
+                               } else {
+                                       return true;
+                               }
+                       }
                );
        }