From 6e7ab16d57da34904dc607c2710b605d336a967e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 8 Jan 2006 04:25:43 +0000 Subject: [PATCH] * 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;) --- includes/MagicWord.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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}"; -- 2.20.1