Index: trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | : null |
37 | 37 | ; |
38 | 38 | $_SERVER['SERVER_SOFTWARE'] = $server; |
| 39 | + wfUrlencode( null ); |
39 | 40 | |
40 | 41 | // do the requested test |
41 | 42 | $this->assertEquals( |
— | — | @@ -49,6 +50,7 @@ |
50 | 51 | } else { |
51 | 52 | $_SERVER['SERVER_SOFTWARE'] = $old; |
52 | 53 | } |
| 54 | + wfUrlencode( null ); |
53 | 55 | } |
54 | 56 | |
55 | 57 | /** |
— | — | @@ -59,14 +61,6 @@ |
60 | 62 | if( is_string( $expectations ) ) { |
61 | 63 | return $expectations; |
62 | 64 | } elseif( is_array( $expectations ) ) { |
63 | | - |
64 | | - /** |
65 | | - * FIXME FIXME FIXME FIXME |
66 | | - * wfUrlencode use a static variable so we can not just |
67 | | - * change the $GLOBALS server name :( |
68 | | - */ |
69 | | - $this->markTestSkipped( 'FIXME: wfUrlencode() use a static, thus changing $GLOBALS[SERVER_SOFTWARE] is useless' ); |
70 | | - |
71 | 65 | if( !array_key_exists( $server, $expectations ) ) { |
72 | 66 | throw new MWException( __METHOD__ . " expectation does not have any value for server name $server. Check the provider array.\n" ); |
73 | 67 | } else { |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -294,6 +294,11 @@ |
295 | 295 | */ |
296 | 296 | function wfUrlencode( $s ) { |
297 | 297 | static $needle; |
| 298 | + if ( is_null( $s ) ) { |
| 299 | + $needle = null; |
| 300 | + return; |
| 301 | + } |
| 302 | + |
298 | 303 | if ( is_null( $needle ) ) { |
299 | 304 | $needle = array( '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F' ); |
300 | 305 | if ( !isset( $_SERVER['SERVER_SOFTWARE'] ) || ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7' ) === false ) ) { |