Merge "Fix use of preg_match_all in MagicWord.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 18 Sep 2015 08:55:54 +0000 (08:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 18 Sep 2015 08:55:54 +0000 (08:55 +0000)
includes/MagicWord.php

index 833f852..2c7ba91 100644 (file)
@@ -950,10 +950,12 @@ class MagicWordArray {
                        if ( $regex === '' ) {
                                continue;
                        }
-                       preg_match_all( $regex, $text, $matches, PREG_SET_ORDER );
-                       foreach ( $matches as $m ) {
-                               list( $name, $param ) = $this->parseMatch( $m );
-                               $found[$name] = $param;
+                       $matches = array();
+                       if ( preg_match_all( $regex, $text, $matches, PREG_SET_ORDER ) ) {
+                               foreach ( $matches as $m ) {
+                                       list( $name, $param ) = $this->parseMatch( $m );
+                                       $found[$name] = $param;
+                               }
                        }
                        $text = preg_replace( $regex, '', $text );
                }