From: Ævar Arnfjörð Bjarmason Date: Sun, 8 Jan 2006 04:25:43 +0000 (+0000) Subject: * Fixed bug, $this->mBaseRegex would contain an invalid regular expression if X-Git-Tag: 1.6.0~700 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=6e7ab16d57da34904dc607c2710b605d336a967e;p=lhc%2Fweb%2Fwiklou.git * Fixed bug, $this->mBaseRegex would contain an invalid regular expression if the supplied magic word synonyms contained /, of course none of them do, but hey;) --- diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 54886b7873..87a332bfc9 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -173,8 +173,13 @@ class MagicWord { # This was used for matching "$1" variables, but different uses of the feature will have # different restrictions, which should be checked *after* the MagicWord has been matched, # not here. - IMSoP - $escSyn = array_map( 'preg_quote', $this->mSynonyms ); + + $escSyn = array(); + foreach ( $this->mSynonyms as $synonym ) + // In case a magic word contains /, like that's going to happen;) + $escSyn[] = preg_quote( $synonym, '/' ); $this->mBaseRegex = implode( '|', $escSyn ); + $case = $this->mCaseSensitive ? '' : 'i'; $this->mRegex = "/{$this->mBaseRegex}/{$case}"; $this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}";