Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoader.php
index f0b48d5..717fb45 100644 (file)
@@ -255,7 +255,10 @@ class ResourceLoader implements LoggerAwareInterface {
                $this->register( include "$IP/resources/ResourcesOOUI.php" );
                // Register extension modules
                $this->register( $config->get( 'ResourceModules' ) );
-               Hooks::run( 'ResourceLoaderRegisterModules', [ &$this ] );
+
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $rl = $this;
+               Hooks::run( 'ResourceLoaderRegisterModules', [ &$rl ] );
 
                if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
                        $this->registerTestModules();
@@ -404,7 +407,9 @@ class ResourceLoader implements LoggerAwareInterface {
                $testModules = [];
                $testModules['qunit'] = [];
                // Get other test suites (e.g. from extensions)
-               Hooks::run( 'ResourceLoaderTestModules', [ &$testModules, &$this ] );
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $rl = $this;
+               Hooks::run( 'ResourceLoaderTestModules', [ &$testModules, &$rl ] );
 
                // Add the testrunner (which configures QUnit) to the dependencies.
                // Since it must be ready before any of the test suites are executed.
@@ -709,7 +714,7 @@ class ResourceLoader implements LoggerAwareInterface {
                        $module = $this->getModule( $name );
                        if ( $module ) {
                                // Do not allow private modules to be loaded from the web.
-                               // This is a security issue, see bug 34907.
+                               // This is a security issue, see T36907.
                                if ( $module->getGroup() === 'private' ) {
                                        $this->logger->debug( "Request for private module '$name' denied" );
                                        $this->errors[] = "Cannot show private module \"$name\"";
@@ -813,6 +818,7 @@ class ResourceLoader implements LoggerAwareInterface {
         * @return void
         */
        protected function sendResponseHeaders( ResourceLoaderContext $context, $etag, $errors ) {
+               \MediaWiki\HeaderCallback::warnIfHeadersSent();
                $rlMaxage = $this->config->get( 'ResourceLoaderMaxage' );
                // Use a short cache expiry so that updates propagate to clients quickly, if:
                // - No version specified (shared resources, e.g. stylesheets)
@@ -1211,7 +1217,7 @@ MESSAGE;
                        $styles = (array)$styles;
                        foreach ( $styles as $style ) {
                                $style = trim( $style );
-                               // Don't output an empty "@media print { }" block (bug 40498)
+                               // Don't output an empty "@media print { }" block (T42498)
                                if ( $style !== '' ) {
                                        // Transform the media type based on request params and config
                                        // The way that this relies on $wgRequest to propagate request params is slightly evil
@@ -1628,7 +1634,7 @@ MESSAGE;
         */
        public function getLessCompiler( $extraVars = [] ) {
                // When called from the installer, it is possible that a required PHP extension
-               // is missing (at least for now; see bug 47564). If this is the case, throw an
+               // is missing (at least for now; see T49564). If this is the case, throw an
                // exception (caught by the installer) to prevent a fatal error later on.
                if ( !class_exists( 'Less_Parser' ) ) {
                        throw new MWException( 'MediaWiki requires the less.php parser' );