From: Alexander Ebert Date: Fri, 13 Jan 2017 13:04:06 +0000 (+0100) Subject: Fixed newlines inside `
` and non-breaking spaces
X-Git-Tag: 3.0.1~48
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=61464fa313853374c1f08afad9fcbd3c567699a3;p=GitHub%2FWoltLab%2FWCF.git

Fixed newlines inside `
` and non-breaking spaces
---

diff --git a/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php
index 34f88e3854..8c90684a15 100644
--- a/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php
+++ b/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php
@@ -53,9 +53,16 @@ abstract class AbstractHtmlNodeProcessor implements IHtmlNodeProcessor {
 		$this->document = new \DOMDocument('1.0', 'UTF-8');
 		$this->xpath = null;
 		
+		$html = preg_replace_callback('~(]*>)(.*?)(
)~s', function($matches) { + return $matches[1] . preg_replace('~\r?\n~', '@@@WCF_PRE_LINEBREAK@@@', $matches[2]) . $matches[3]; + }, $html); + // strip UTF-8 zero-width whitespace $html = preg_replace('~\x{200B}~u', '', $html); + // discard any non-breaking spaces + $html = str_replace(' ', ' ', $html); + // work-around for a libxml bug that causes a single space between // some inline elements to be dropped $html = str_replace('> <', '> <', $html); @@ -101,6 +108,9 @@ abstract class AbstractHtmlNodeProcessor implements IHtmlNodeProcessor { } + // restore line breaks inside code + $html = str_replace('@@@WCF_PRE_LINEBREAK@@@', "\n", $html); + // work-around for a libxml bug that causes a single space between // some inline elements to be dropped $html = str_replace(' ', ' ', $html);