Last modified: 2010-05-15 15:26:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T3570, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1570 - fgets usage in GlobalFunctions/wfMerge() not compatible with PHP < 4.2.0
fgets usage in GlobalFunctions/wfMerge() not compatible with PHP < 4.2.0
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
History/Diffs (Other open bugs)
1.3.x
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-21 07:42 UTC by Paul Fenwick
Modified: 2010-05-15 15:26 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch that solves the bug described in this ticket. (413 bytes, patch)
2005-02-21 07:45 UTC, Paul Fenwick
Details

Description Paul Fenwick 2005-02-21 07:42:34 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;
Comment 1 Paul Fenwick 2005-02-21 07:45:03 UTC
Created attachment 300 [details]
Patch that solves the bug described in this ticket.
Comment 2 Antoine "hashar" Musso (WMF) 2005-03-04 12:56:27 UTC
commited to REL1_4 and HEAD, REL1_3 being frozen.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links