function compatChecks() { $test = new PhpXmlBugTester(); if (!$test->ok) { $this->error("Your system has a combination of PHP and libxml2 versions which is buggy\n" . "and can cause hidden data corruption in MediaWiki and other web apps.\n" . "Upgrade to PHP 5.2.9 or later and libxml2 2.7.3 or later!\n" . "ABORTING (see http://bugs.php.net/bug.php?id=45996).\n", true); } $test = new PhpRefCallBugTester(); $test->execute(); if (!$test->ok) { $ver = phpversion(); $this->error("PHP {$ver} is not compatible with MediaWiki due to a bug involving\n" . "reference parameters to __call. Upgrade to PHP 5.3.2 or higher, or \n" . "downgrade to PHP 5.3.0 to fix this.\n" . "ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n", true); } }
function compatChecks() { // Avoid syntax error in PHP4 $minimumPcreVersion = constant( 'Installer::MINIMUM_PCRE_VERSION' ); list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 ); if ( version_compare( $pcreVersion, $minimumPcreVersion, '<' ) ) { $this->error( "PCRE $minimumPcreVersion or later is required.\n" . "Your PHP binary is linked with PCRE $pcreVersion.\n\n" . "More information:\n" . "https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms/PCRE\n\n" . "ABORTING.\n", true ); } $test = new PhpXmlBugTester(); if ( !$test->ok ) { $this->error( "Your system has a combination of PHP and libxml2 versions which is buggy\n" . "and can cause hidden data corruption in MediaWiki and other web apps.\n" . "Upgrade to PHP 5.2.9 or later and libxml2 2.7.3 or later!\n" . "ABORTING (see http://bugs.php.net/bug.php?id=45996).\n", true ); } $test = new PhpRefCallBugTester; $test->execute(); if ( !$test->ok ) { $ver = phpversion(); $this->error( "PHP $ver is not compatible with MediaWiki due to a bug involving\n" . "reference parameters to __call. Upgrade to PHP 5.3.2 or higher, or \n" . "downgrade to PHP 5.3.0 to fix this.\n" . "ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n", true ); } }
/** * Test PHP (probably 5.3.1, but it could regress again) to make sure that * reference parameters to __call() are not converted to null */ protected function envCheckPHP531() { $test = new PhpRefCallBugTester(); $test->execute(); if (!$test->ok) { $this->showError('config-using531', phpversion()); return false; } }
/** * Test for PHP bug #50394 (PHP 5.3.x conversion to null only, not 5.2.x) */ class PhpRefCallBugTester { public $ok = false; function __call($name, $args) { $old = error_reporting(E_ALL & ~E_WARNING); call_user_func_array(array($this, 'checkForBrokenRef'), $args); error_reporting($old); } function checkForBrokenRef(&$var) { if ($var) { $this->ok = true; } } function execute() { $var = true; call_user_func_array(array($this, 'foo'), array(&$var)); } } $test = new PhpRefCallBugTester(); $test->execute(); if (!$test->ok) { echo "Test failed\n"; } else { echo "Test passed\n"; }