Skip to content

Commit

Permalink
Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stronk7 committed Jun 10, 2006
1 parent c0bd060 commit 5dd95d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backup/backuplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,11 @@ function full_tag($tag,$level=0,$endline=true,$content,$attributes=null) {

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));
Expand Down

0 comments on commit 5dd95d3

Please sign in to comment.