The convert_urls_into_links function in lib/weblib.php has bad regular expressions.
The regex used sucks up anything after the domain until it hits a space.
Something like
<p>text www.example.com</p> text
gets completely trashed, and produces
<p>text <a href="http://www.apple.com</p" target="_blank">www.example.com</p</a>> text
Which in effect makes the rest of the content vanish.
I changed the regex to fix it.
I just rewrote the regexes, but it's much better than what was there... I only mess with http(s):// or www urls with at least one period in the host string.
Also no longer using the deprecated ereg function. See MDL-20821
function convert_urls_into_links(&$text) {
/// Make lone URLs into links. eg http://moodle.com/
$text = preg_replace("!([[:space:]]|^|(|[)(https?)://([[:alnum:]]\.[:alnum:].;_%#?/&=[[:alnum:]])!i",
"
1<a href=\"\\2://\\3\" target=\"_blank\">\\2://
3</a>", $text);
/// eg www.moodle.com
$text = preg_replace("!([[:space:]]|^|(|[)www\.([[:alnum:]]\.[:alnum:].;_%#?/&=[[:alnum:]])!i",
"
1<a href=\"http://www.\\2\" target=\"_blank\">www.
2</a>", $text);
}