Fix warning in PHP 5.1 when feeding Title objects to wfArrayToCGI(). Also enforce...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 12 Apr 2009 17:38:41 +0000 (17:38 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 12 Apr 2009 17:38:41 +0000 (17:38 +0000)
includes/GlobalFunctions.php

index 2ca81c9..d69c289 100644 (file)
@@ -1230,18 +1230,18 @@ function wfArrayToCGI( $array1, $array2 = NULL )
                        if ( '' != $cgi ) {
                                $cgi .= '&';
                        }
-                       if(is_array($value))
-                       {
+                       if ( is_array( $value ) ) {
                                $firstTime = true;
-                               foreach($value as $v)
-                               {
-                                       $cgi .= ($firstTime ? '' : '&') .
+                               foreach ( $value as $v ) {
+                                       $cgi .= ( $firstTime ? '' : '&') .
                                                urlencode( $key . '[]' ) . '=' .
                                                urlencode( $v );
                                        $firstTime = false;
                                }
-                       }
-                       else
+                       } else {
+                               if ( is_object( $value ) ) {
+                                       $value = $value->__toString();
+                               }
                                $cgi .= urlencode( $key ) . '=' .
                                        urlencode( $value );
                }