X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMagicWord.php;h=2c7ba91bf2bb0daa88aa3d3d6c4ec86575ee2d05;hb=1b39760a3ab3dd88e1412f289392c69aeff99c6a;hp=424735e51ba381365fa245c717383d241067a73f;hpb=36c237a3863773b13e4ce5cf0568513c8d1993ee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 424735e51b..2c7ba91bf2 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -941,7 +941,6 @@ class MagicWordArray { * * @param string $text * - * @throws Exception * @return array */ public function matchAndRemove( &$text ) { @@ -952,22 +951,13 @@ class MagicWordArray { continue; } $matches = array(); - $matched = preg_match_all( $regex, $text, $matches, PREG_SET_ORDER ); - if ( $matched === false ) { - throw new Exception( __METHOD__ . ': preg_match_all returned false' ); - } - if ( $matched ) { + if ( preg_match_all( $regex, $text, $matches, PREG_SET_ORDER ) ) { foreach ( $matches as $m ) { list( $name, $param ) = $this->parseMatch( $m ); $found[$name] = $param; } } - $replaced = preg_replace( $regex, '', $text ); - if ( $replaced !== null ) { - $text = $replaced; - } else { - throw new Exception( __METHOD__ . ': preg_replace returned null' ); - } + $text = preg_replace( $regex, '', $text ); } return $found; }