Last modified: 2010-05-15 15:26:45 UTC
G'day wonderful PHP wiki developers, While PHP versions before 4.3 are not actively supported by MediaWiki, it nevertheless runs extremely well on legacy PHP platforms. However I have discovered an issue that prevents edit conflicts from correctly being resolved MediaWiki is deployed on versions of PHP before 4.2.0. The fgets() PHP function can take a parameter of how many characters to read from a filehandle. In 4.2.0 and above this is optional, but before 4.2.0 it was a required paramter. The wfMerge() function in GlobalFunctions.php does not supply this paramter to fgets(). The result is a PHP error when trying to manage edit conflicts, which can result in work being lost if two editors are working on a page at the same time. The correction to this is trivial; we simply supply a second parameter to fgets. This is compatible with all versions of PHP 4. A patch against MediaWiki 1.3.11 is supplied below. A value of 1024 bytes has been arbitarily chosen as this corresponds to the default behaviour of single-argument fgets() under PHP 4.2.x. Many thanks for an excellent wiki platform. All the very best, Paul --- mediawiki-1.3.11/includes/GlobalFunctions.php Thu Oct 28 00:34:51 2004 +++ wiki/includes/GlobalFunctions.php Tue Feb 8 23:11:46 2005 @@ -849,7 +849,7 @@ wfEscapeShellArg( $yourtextName ); $handle = popen( $cmd, 'r' ); - if( fgets( $handle ) ){ + if( fgets( $handle, 1024 ) ){ $conflict = true; } else { $conflict = false;
Created attachment 300 [details] Patch that solves the bug described in this ticket.
commited to REL1_4 and HEAD, REL1_3 being frozen.