Fix bug in getXVO() that produced XVO headers with stray semicolons
authorCatrope <roan.kattouw@gmail.com>
Fri, 1 Jun 2012 10:19:53 +0000 (03:19 -0700)
committerCatrope <roan.kattouw@gmail.com>
Fri, 1 Jun 2012 12:50:30 +0000 (05:50 -0700)
addVaryHeader() converts $options to an array, so null values (no XVO
options) are converted to empty arrays. This led to headers like:

X-Vary-Options: Foo;string-contains=bar,Baz;,Quux;string-contains=xyz

This fix changes the "Baz;," part to "Baz,"

Change-Id: I2fa0b374f5d4cfa6b894cbd9de8c14354f04ad86

includes/OutputPage.php

index 560588f..35b2f38 100644 (file)
@@ -1739,7 +1739,7 @@ class OutputPage extends ContextSource {
                $headers = array();
                foreach( $this->mVaryHeader as $header => $option ) {
                        $newheader = $header;
-                       if( is_array( $option ) ) {
+                       if ( is_array( $option ) && count( $option ) > 0 ) {
                                $newheader .= ';' . implode( ';', $option );
                        }
                        $headers[] = $newheader;