Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / includes / actions / RawAction.php
index b371848..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', array( &$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" );
                }
 
@@ -228,7 +236,7 @@ class RawAction extends FormlessAction {
                        }
                }
 
-               $allowedCTypes = array( 'text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit' );
+               $allowedCTypes = [ 'text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit' ];
                if ( $ctype == '' || !in_array( $ctype, $allowedCTypes ) ) {
                        $ctype = 'text/x-wiki';
                }