Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / includes / actions / RawAction.php
index c7b18a4..d8c8bc3 100644 (file)
@@ -80,6 +80,12 @@ class RawAction extends FormlessAction {
                        }
                }
 
+               // Set standard Vary headers so cache varies on cookies and such (T125283)
+               $response->header( $this->getOutput()->getVaryHeader() );
+               if ( $config->get( 'UseKeyHeader' ) ) {
+                       $response->header( $this->getOutput()->getKeyHeader() );
+               }
+
                $response->header( 'Content-type: ' . $contentType . '; charset=UTF-8' );
                // Output may contain user-specific data;
                // vary generated content for open sessions on private wikis
@@ -102,7 +108,9 @@ class RawAction extends FormlessAction {
                        $response->statusHeader( 404 );
                }
 
-               if ( !Hooks::run( 'RawPageViewBeforeOutput', [ &$this, &$text ] ) ) {
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $rawAction = $this;
+               if ( !Hooks::run( 'RawPageViewBeforeOutput', [ &$rawAction, &$text ] ) ) {
                        wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" );
                }