r61072 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61071‎ | r61072 | r61073 >
Date:01:29, 15 January 2010
Author:tstarling
Status:ok (Comments)
Tags:
Comment:
PHP 5.3.2 might not be out until February, by which time a number of distros will probably be using PHP 5.3.1. Replacing the version number check with a direct bug #50394 check, so that distros or other users can backport the one-line fix without having to upgrade to 5.3.2.
Modified paths:
  • /trunk/phase3/config/Installer.php (modified) (history)
  • /trunk/phase3/maintenance/install-utils.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/install-utils.inc
@@ -15,13 +15,13 @@
1616 if( !function_exists( 'version_compare' ) ) {
1717 # version_compare was introduced in 4.1.0
1818 echo "Your PHP version is much too old; 4.0.x will _not_ work. 5.0.0 or higher is required. ABORTING.\n";
19 - die( -1 );
 19+ die( 1 );
2020 }
2121 if( version_compare( phpversion(), '5.0.0' ) < 0 ) {
2222 echo "PHP 5.0.0 or higher is required. If PHP 5 is available only when \n".
2323 "PHP files have a .php5 extension, please navigate to <a href=\"index.php5\">index.php5</a> \n".
2424 "to continue installation. ABORTING.\n";
25 - die( -1 );
 25+ die( 1 );
2626 }
2727
2828 // Test for PHP bug which breaks PHP 5.0.x on 64-bit...
@@ -31,7 +31,7 @@
3232 if( !isset( $borked[-1] ) ) {
3333 echo "PHP 5.0.x is buggy on your 64-bit system; you must upgrade to PHP 5.1.x\n" .
3434 "or higher. ABORTING. (http://bugs.php.net/bug.php?id=34879 for details)\n";
35 - die( -1 );
 35+ die( 1 );
3636 }
3737
3838 $test = new PhpXmlBugTester();
@@ -40,10 +40,21 @@
4141 "and can cause hidden data corruption in MediaWiki and other web apps.\n" .
4242 "Upgrade to PHP 5.2.9 or later and libxml2 2.7.3 or later!\n" .
4343 "ABORTING (http://bugs.php.net/bug.php?id=45996 for details).\n";
44 - die( -1 );
 44+ die( 1 );
4545 }
4646
 47+ $test = new PhpRefCallBugTester;
 48+ $ok = false;
 49+ call_user_func_array( array( $test, 'test' ), array( &$ok ) );
 50+ if ( !$ok ) {
 51+ echo "PHP 5.3.1 is not compatible with MediaWiki due to a bug involving\n" .
 52+ "reference parameters to __call. Upgrade to PHP 5.3.2, or downgrade\n" .
 53+ "to PHP 5.3.0 to fix this.\n" .
 54+ "ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n";
 55+ die( 1 );
 56+ }
4757
 58+
4859 global $wgCommandLineMode;
4960 $wgCommandLineMode = true;
5061 umask( 000 );
@@ -72,6 +83,15 @@
7384 }
7485 }
7586
 87+/**
 88+ * Test for PHP bug #50394
 89+ */
 90+class PhpRefCallBugTester {
 91+ function __call( $name, $args ) {
 92+ $args[0] = true;
 93+ }
 94+}
 95+
7696 function readconsole( $prompt = '' ) {
7797 static $isatty = null;
7898 if ( is_null( $isatty ) ) {
Index: trunk/phase3/config/Installer.php
@@ -419,13 +419,6 @@
420420 <?php
421421 }
422422
423 -if( phpversion() === '5.3.1' ) {
424 - $fatal = true;
425 - ?><li class="error"><strong>Fatal: PHP 5.3.1 is not compatible with MediaWiki!</strong>
426 - PHP 5.3.1 is not compatible with MediaWiki due to a <a href="http://news.php.net/php.internals/46389">bug in PHP</a>. Please use PHP 5.3.0, or PHP 5.3.2 or later.</li>
427 - <?php
428 -}
429 -
430423 if( $fatal ) {
431424 dieout( "Cannot install MediaWiki." );
432425 }

Comments

#Comment by Reedy (talk | contribs)   07:20, 15 January 2010

For reference, http://bugs.php.net/bug.php?id=50394 is the bug, it's not on our tracker

#Comment by 😂 (talk | contribs)   11:31, 15 January 2010

Yeah, that's the PHP bug. Our bug is https://bugzilla.wikimedia.org/show_bug.cgi?id=21793

#Comment by Platonides (talk | contribs)   15:13, 15 January 2010

I mentioned the bug to Raphael Geissert, from Debian php. My main concern, which was the next Debian stable, is likely to have 5.3.2 ("5.3.2 will be out very late January/early February"), but he also mentioned that in the meanwhile they can backport it. If Debian backported it, derivative distros like Ubuntu would also patch it.

The error message should be improved for affected users of the 5.2 serie.

Status & tagging log