Suppress notice from ParserOutput::__sleep()
authorTim Starling <tstarling@wikimedia.org>
Thu, 1 Aug 2019 00:08:38 +0000 (10:08 +1000)
committerTim Starling <tstarling@wikimedia.org>
Thu, 1 Aug 2019 00:11:12 +0000 (10:11 +1000)
Bug: T229366
Change-Id: I8f0a537f0b6b76aac0c52e691ec4653c51c49940

includes/parser/ParserOutput.php

index cbba80a..1922f7d 100644 (file)
@@ -1326,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;
+                               }
+                       }
                );
        }