From: stronk7 Date: Sat, 10 Jun 2006 23:33:49 +0000 (+0000) Subject: Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5dd95d35e58d5edace8bc7130a35d3109415416d;p=moodle.git Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775) the [[cntrl]] pcre class was breaking some chars. Changed to a safer alternative. Bug 5777. (http://moodle.org/bugs/bug.php?op=show&bugid=5777) Merged from MOODLE_16_STABLE --- diff --git a/backup/backuplib.php b/backup/backuplib.php index 99f6fec7a8..e551d55666 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -460,10 +460,11 @@ function xml_tag_safe_content($content) { global $CFG; - //If enabled, we strip all the control chars from the text but tabs, newlines and returns + //If enabled, we strip all the control chars (\x0-\x1f) from the text but tabs (\x9), + //newlines (\xa) and returns (\xd). The delete control char (\x7f) is also included. //because they are forbiden in XML 1.0 specs. The expression below seems to be //UTF-8 safe too because it simply ignores the rest of characters. - $content = preg_replace("/(?(?=[[:cntrl:]])[^\n\r\t])/is","",$content); + $content = preg_replace("/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is","",$content); if (!empty($CFG->unicodedb)) { // Don't perform the conversion. Contents are Unicode. $content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));