Index: trunk/phase3/maintenance/install-utils.inc |
— | — | @@ -44,17 +44,15 @@ |
45 | 45 | } |
46 | 46 | |
47 | 47 | $test = new PhpRefCallBugTester; |
48 | | - $ok = false; |
49 | | - call_user_func_array( array( $test, 'test' ), array( &$ok ) ); |
50 | | - if ( !$ok ) { |
51 | | - echo "PHP 5.2.11, 5.2.12, and 5.3.1 (your version: " . phpversion() . ") are not compatible with\n" . |
52 | | - "MediaWiki due to a bug involving reference parameters to __call. Upgrade to\n" . |
53 | | - "PHP 5.3.2 (5.2.13 for 5.2 users), or downgrade to PHP 5.3.0 (5.2.10 for 5.2\n" . |
54 | | - "users) to fix this. ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n"; |
| 48 | + $test->execute(); |
| 49 | + if ( !$test->ok ) { |
| 50 | + echo "PHP 5.3.1 is not compatible with MediaWiki due to a bug involving\n" . |
| 51 | + "reference parameters to __call. Upgrade to PHP 5.3.2 or higher, or \n" . |
| 52 | + "downgrade to PHP 5.3.0 to fix this.\n" . |
| 53 | + "ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n"; |
55 | 54 | die( 1 ); |
56 | 55 | } |
57 | 56 | |
58 | | - |
59 | 57 | global $wgCommandLineMode; |
60 | 58 | $wgCommandLineMode = true; |
61 | 59 | umask( 000 ); |
— | — | @@ -84,12 +82,27 @@ |
85 | 83 | } |
86 | 84 | |
87 | 85 | /** |
88 | | - * Test for PHP bug #50394 |
| 86 | + * Test for PHP bug #50394 (PHP 5.3.x conversion to null only, not 5.2.x) |
89 | 87 | */ |
90 | 88 | class PhpRefCallBugTester { |
| 89 | + public $ok = false; |
| 90 | + |
91 | 91 | function __call( $name, $args ) { |
92 | | - $args[0] = true; |
| 92 | + $old = error_reporting( E_ALL & ~E_WARNING ); |
| 93 | + call_user_func_array( array( $this, 'checkForBrokenRef' ), $args ); |
| 94 | + error_reporting( $old ); |
93 | 95 | } |
| 96 | + |
| 97 | + function checkForBrokenRef( &$var ) { |
| 98 | + if ( $var ) { |
| 99 | + $this->ok = true; |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + function execute() { |
| 104 | + $var = true; |
| 105 | + call_user_func_array( array( $this, 'foo' ), array( &$var ) ); |
| 106 | + } |
94 | 107 | } |
95 | 108 | |
96 | 109 | function readconsole( $prompt = '' ) { |