* (bug 26861) avoid warning in OutputPage::addVaryHeader when $options param is null
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 22 Jan 2011 16:59:01 +0000 (16:59 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 22 Jan 2011 16:59:01 +0000 (16:59 +0000)
This should coerce nulls to empty arrays to make them play a little nicer.

Also added a doc comment that the format and contents of the $option parameter need to be described in some way; judging by the below getXVO() function they're used to produce the X-Vary-Options header along with the vary cookie settings, but offhand wouldn't know what acceptable options are or how to look them up (X-Vary-Options is something we made up as an extension for our patched Squid servers, so there's no public standard like the HTTP RFCs to look it up in.)

includes/OutputPage.php

index 960b293..caa5fd1 100644 (file)
@@ -1471,10 +1471,12 @@ class OutputPage {
         *
         * @param $header String: header name
         * @param $option either an Array or null
+        * @fixme Document the $option parameter; it appears to be for
+        *        X-Vary-Options but what format is acceptable?
         */
        public function addVaryHeader( $header, $option = null ) {
                if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
-                       $this->mVaryHeader[$header] = $option;
+                       $this->mVaryHeader[$header] = (array)$option;
                } elseif( is_array( $option ) ) {
                        if( is_array( $this->mVaryHeader[$header] ) ) {
                                $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );