r102540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102539‎ | r102540 | r102541 >
Date:17:27, 9 November 2011
Author:hashar
Status:ok
Tags:
Comment:
MFT to REL1_18 r92960

Make wfUrlEncode(null) reset the static. Two skipped tests work now.
Modified paths:
  • /branches/REL1_18/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/REL1_18/phase3/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php
@@ -35,6 +35,7 @@
3636 : null
3737 ;
3838 $_SERVER['SERVER_SOFTWARE'] = $server;
 39+ wfUrlencode( null );
3940
4041 // do the requested test
4142 $this->assertEquals(
@@ -49,6 +50,7 @@
5051 } else {
5152 $_SERVER['SERVER_SOFTWARE'] = $old;
5253 }
 54+ wfUrlencode( null );
5355 }
5456
5557 /**
@@ -59,14 +61,6 @@
6062 if( is_string( $expectations ) ) {
6163 return $expectations;
6264 } 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 -
7165 if( !array_key_exists( $server, $expectations ) ) {
7266 throw new MWException( __METHOD__ . " expectation does not have any value for server name $server. Check the provider array.\n" );
7367 } else {
Index: branches/REL1_18/phase3/includes/GlobalFunctions.php
@@ -294,6 +294,11 @@
295295 */
296296 function wfUrlencode( $s ) {
297297 static $needle;
 298+ if ( is_null( $s ) ) {
 299+ $needle = null;
 300+ return;
 301+ }
 302+
298303 if ( is_null( $needle ) ) {
299304 $needle = array( '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F' );
300305 if ( !isset( $_SERVER['SERVER_SOFTWARE'] ) || ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7' ) === false ) ) {
Property changes on: branches/REL1_18/phase3/includes/GlobalFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
301306 Merged /trunk/phase3/includes/GlobalFunctions.php:r92960

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92960Make wfUrlEncode(null) reset the static. Two skipped tests work now.platonides20:14, 23 July 2011

Status & tagging log