64,65c64,71 < for ($i = 0; $i < $unclosed; $i++) < $body .= '[/quote]'; --- > if ($unclosed < 0) { //then we have too many end tags... > $body = preg_replace('/\[\/quote\]/i', '', $body, abs($unclosed)); > } > else { //we have too many open tags! > for ($i = 0; $i < $unclosed; $i++) { > $body .= '[/quote]'; > } > }