From: Matthew Exon Date: Tue, 26 Feb 2013 23:34:40 +0000 (+0800) Subject: For very large posts (~18k) with lots of markup, these regexes were causing enough... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=63be0062b6f24d81a4ea78a1946ff3688667b49f;p=friendica.git For very large posts (~18k) with lots of markup, these regexes were causing enough backtracking for php to run out of memory, silently generating an empty entry. This tightens up the regexes so they do less backtracking. --- diff --git a/include/bbcode.php b/include/bbcode.php index a587d8c380..cec13d9197 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -642,8 +642,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal $Text = preg_replace('/\"\;/','"',$Text); // fix any escaped ampersands that may have been converted into links - $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text); - $Text = preg_replace("/\<(.*?)(src|href)=\"[^hfm](.*?)\>/ism",'<$1$2="">',$Text); + $Text = preg_replace("/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text); + $Text = preg_replace("/\<([^>]*?)(src|href)=\"[^hfm](.*?)\>/ism",'<$1$2="">',$Text); if($saved_image) $Text = bb_replace_images($Text, $saved_image);