'config-xml-bad' => "PHP's XML module is missing.
MediaWiki requires functions in this module and will not work in this configuration.
If you're running Mandrake, install the php-xml package.",
- 'config-pcre' => 'The PCRE support module appears to be missing.
-MediaWiki requires the Perl-compatible regular expression functions to work.',
+ 'config-pcre-old' => "'''Fatal:''' PCRE $1 or later is required.
+Your PHP binary is linked with PCRE $2.
+[https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms/PCRE More information].",
'config-pcre-no-utf8' => "'''Fatal:''' PHP's PCRE module seems to be compiled without PCRE_UTF8 support.
MediaWiki requires UTF-8 support to function correctly.",
'config-memory-raised' => "PHP's <code>memory_limit</code> is $1, raised to $2.",
'config-mbstring' => '{{Related|Config-fatal}}',
'config-ze1' => '{{Related|Config-fatal}}',
'config-pcre' => 'PCRE is an initialism for "Perl-compatible regular expression". Perl is programming language whose [[:w:regular expression|regular expression]] syntax is popular and used in other languages using a library called PCRE.',
+ 'config-pcre-old' => 'Parameters:
+* $1 - minimum PCRE version number
+* $2 - the installed version of [[wikipedia:PCRE|PCRE]]
+{{Related|Config-fatal}}',
'config-pcre-no-utf8' => "PCRE is a name of a programmers' library for supporting regular expressions. It can probably be translated without change.
{{Related|Config-fatal}}",
'config-memory-raised' => 'Parameters:
// This is the absolute minimum PHP version we can support
const MINIMUM_PHP_VERSION = '5.3.2';
+ /**
+ * The oldest version of PCRE we can support.
+ *
+ * Defining this is necessary because PHP may be linked with a system version
+ * of PCRE, which may be older than that bundled with the minimum PHP version.
+ */
+ const MINIMUM_PCRE_VERSION = '7.2';
+
/**
* @var array
*/
$good = false;
}
+ // Must go here because an old version of PCRE can prevent other checks from completing
+ if ( $good ) {
+ list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
+ if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
+ $this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
+ $good = false;
+ }
+ }
+
if ( $good ) {
foreach ( $this->envChecks as $check ) {
$status = $this->$check();
* @return bool
*/
protected function envCheckPCRE() {
- if ( !function_exists( 'preg_match' ) ) {
- $this->showError( 'config-pcre' );
-
- return false;
- }
wfSuppressWarnings();
$regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
// Need to check for \p support too, as PCRE can be compiled
}
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(