From: Brion Vibber Date: Mon, 8 Mar 2004 02:46:27 +0000 (+0000) Subject: Fixed what seems to be an off-by-one error (it tried to access one past the end of... X-Git-Tag: 1.3.0beta1~843 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=ddacf874df2d8c9bc25cd48b75e060fc95f9da62;p=lhc%2Fweb%2Fwiklou.git Fixed what seems to be an off-by-one error (it tried to access one past the end of the array quite consistently). Someone who understands this code, please check. --- diff --git a/includes/Tokenizer.php b/includes/Tokenizer.php index 1556dd4799..e563a7c8e5 100644 --- a/includes/Tokenizer.php +++ b/includes/Tokenizer.php @@ -64,7 +64,7 @@ class Tokenizer { function previewToken() { - if ( $this->mMatchPos <= $this->mCount ) { + if ( $this->mMatchPos < $this->mCount ) { $token["pos"] = $this->mPos; if ( $this->mPos < $this->mMatch[0][$this->mMatchPos][1] ) { $token["type"] = "text"; @@ -76,7 +76,7 @@ class Tokenizer { } else { # If linkPrefixExtension is set, $this->mMatch[2][$this->mMatchPos][0] # contains the link prefix, or is null if no link prefix exist. - if ( $this->mMatch[2][$this->mMatchPos][0] ) + if ( isset( $this->mMatch[2] ) && $this->mMatch[2][$this->mMatchPos][0] ) { # prefixed link open tag, [0] is "prefix[[" $token["type"] = "[[";