]> git.mjollnir.org Git - moodle.git/commitdiff
Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775)
authorstronk7 <stronk7>
Sat, 10 Jun 2006 23:33:49 +0000 (23:33 +0000)
committerstronk7 <stronk7>
Sat, 10 Jun 2006 23:33:49 +0000 (23:33 +0000)
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

backup/backuplib.php

index 99f6fec7a8dce4f54c38c25bc25dc556c37ad9ad..e551d55666203d8e9b7fdb4750b09218759a4cb6 100644 (file)
 
     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));