Merge "(bug 38249) No PCRE unicode causes installer to spew giberish"
authorCatrope <roan.kattouw@gmail.com>
Wed, 22 Aug 2012 01:37:47 +0000 (01:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 22 Aug 2012 01:37:47 +0000 (01:37 +0000)
RELEASE-NOTES-1.20
includes/installer/Installer.php
includes/parser/Parser.php

index 3364519..012d04d 100644 (file)
@@ -214,6 +214,8 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
   are now remembered between successive clicks.
 * (bug 26069) Page title is no longer "Error" for all error pages
 * (bug 39297) Show warning if thumbnail of animated image will not be animated.
+* (bug 38249) Parser will throw an exception instead of outputting gibberish if
+  PCRE is compiled without support for unicode properties.
 
 === API changes in 1.20 ===
 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
index d87f294..2cad7d1 100644 (file)
@@ -788,6 +788,10 @@ abstract class Installer {
 
        /**
         * Environment check for the PCRE module.
+        *
+        * @note If this check were to fail, the parser would
+        *   probably throw an exception before the result
+        *   of this check is shown to the user.
         * @return bool
         */
        protected function envCheckPCRE() {
@@ -797,8 +801,13 @@ abstract class Installer {
                }
                wfSuppressWarnings();
                $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
+               // Need to check for \p support too, as PCRE can be compiled
+               // with utf8 support, but not unicode property support.
+               // check that \p{Zs} (space separators) matches
+               // U+3000 (Ideographic space)
+               $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
                wfRestoreWarnings();
-               if ( $regexd != '--' ) {
+               if ( $regexd != '--' || $regexprop != '--' ) {
                        $this->showError( 'config-pcre-no-utf8' );
                        return false;
                }
index 2d5f966..489451a 100644 (file)
@@ -1522,6 +1522,9 @@ class Parser {
                wfProfileIn( __METHOD__ );
 
                $bits = preg_split( $this->mExtLinkBracketedRegex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
+               if ( $bits === false ) {
+                       throw new MWException( "PCRE needs to be compiled with --enable-unicode-properties in order for MediaWiki to function" );
+               }
                $s = array_shift( $bits );
 
                $i = 0;