From: friendica Date: Thu, 23 Feb 2012 04:58:04 +0000 (-0800) Subject: nested quote check fails to account for strpos returning position 0 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3c6b127d40e2f0ea1c2d8eb7114c3e121b58ba2e;p=friendica.git nested quote check fails to account for strpos returning position 0 --- diff --git a/include/bbcode.php b/include/bbcode.php index d639b0c39a..32053b4ecd 100755 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -194,7 +194,7 @@ function bbcode($Text,$preserve_nl = false) { // Check for [quote] text // handle nested quotes $endlessloop = 0; - while (strpos($Text, "[/quote]") and strpos($Text, "[quote]") and (++$endlessloop < 20)) + while (strpos($Text, "[/quote]") !== false and strpos($Text, "[quote]") !== false and (++$endlessloop < 20)) $Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism","$QuoteLayout", $Text); // Check for [quote=Author] text @@ -203,7 +203,7 @@ function bbcode($Text,$preserve_nl = false) { // handle nested quotes $endlessloop = 0; - while (strpos($Text, "[/quote]") and strpos($Text, "[quote=") and (++$endlessloop < 20)) + while (strpos($Text, "[/quote]") !== false and strpos($Text, "[quote=") !== false and (++$endlessloop < 20)) $Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism", "
" . $t_wrote . " $2
", $Text);