Issue #3311595 by fjgarlin, mfb, pooja saraah, colorfield, alexpott, Wim Leers, longwave: Html::transformRootRelativeUrlsToAbsolute() replaces "\r\n" with " \n"
parent
2193f7675d
commit
3589a503aa
|
@ -279,6 +279,11 @@ class Html {
|
|||
<body>!html</body>
|
||||
</html>
|
||||
EOD;
|
||||
|
||||
// PHP's \DOMDocument::saveXML() encodes carriage returns as so
|
||||
// normalize all newlines to line feeds.
|
||||
$html = str_replace(["\r\n", "\r"], "\n", $html);
|
||||
|
||||
// PHP's \DOMDocument serialization adds extra whitespace when the markup
|
||||
// of the wrapping document contains newlines, so ensure we remove all
|
||||
// newlines before injecting the actual HTML body to be processed.
|
||||
|
|
|
@ -390,6 +390,11 @@ class HtmlTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
// Double-character carriage return should be normalized.
|
||||
$data['line break with double special character'] = ["Test without links but with\r\nsome special characters", 'http://example.com', "Test without links but with\nsome special characters"];
|
||||
$data['line break with single special character'] = ["Test without links but with \nsome special characters", 'http://example.com', FALSE];
|
||||
$data['carriage return within html'] = ["<a\rhref='/node'>My link</a>", 'http://example.com', '<a href="http://example.com/node">My link</a>'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue