Merge "resourceloader: Remove getters for private constants in mw.loader.store"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 1 Aug 2019 16:58:17 +0000 (16:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 1 Aug 2019 16:58:17 +0000 (16:58 +0000)
includes/parser/ParserOutput.php
includes/resourceloader/MessageBlobStore.php
includes/resourceloader/ResourceLoaderStartUpModule.php
resources/Resources.php
tests/phpunit/structure/ResourcesTest.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;
+                               }
+                       }
                );
        }
 
index fca06c9..d0f6729 100644 (file)
@@ -224,7 +224,7 @@ class MessageBlobStore implements LoggerAwareInterface {
                        }
                }
 
-               $json = FormatJson::encode( (object)$messages );
+               $json = FormatJson::encode( (object)$messages, false, FormatJson::UTF8_OK );
                // @codeCoverageIgnoreStart
                if ( $json === false ) {
                        $this->logger->warning( 'Failed to encode message blob for {module} ({lang})', [
index 6b38ee4..dbf6b21 100644 (file)
@@ -283,8 +283,9 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        }
 
                        if ( $versionHash !== '' && strlen( $versionHash ) !== 7 ) {
-                               $this->getLogger()->warning(
-                                       "Module '{module}' produced an invalid version hash: '{version}'.",
+                               $e = new RuntimeException( "Badly formatted module version hash" );
+                               $resourceLoader->outputErrorAndLog( $e,
+                                               "Module '{module}' produced an invalid version hash: '{version}'.",
                                        [
                                                'module' => $name,
                                                'version' => $versionHash,
index e29d658..980bdc4 100644 (file)
@@ -1154,6 +1154,7 @@ return [
                        'upload-form-label-usage-filename',
                        'action-upload',
                        'apierror-mustbeloggedin',
+                       'apierror-permissiondenied',
                        'badaccess-groups',
                        'apierror-timeout',
                        'apierror-offline',
index 4f9664f..acd8a19 100644 (file)
@@ -36,14 +36,6 @@ class ResourcesTest extends MediaWikiTestCase {
                );
        }
 
-       public function testVersionHash() {
-               $data = self::getAllModules();
-               foreach ( $data['modules'] as $moduleName => $module ) {
-                       $version = $module->getVersionHash( $data['context'] );
-                       $this->assertEquals( 7, strlen( $version ), "$moduleName must use ResourceLoader::makeHash" );
-               }
-       }
-
        /**
         * Verify that all modules specified as dependencies of other modules actually
         * exist and are not illegal.