Updated regex
authorAlexander Ebert <ebert@woltlab.com>
Thu, 8 Dec 2016 18:54:26 +0000 (19:54 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 8 Dec 2016 18:54:26 +0000 (19:54 +0100)
The old regex was taken from `StringUtil::trim()` and has been replaced
with the new version.

wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php

index dbd63c9775d33e0828d737df9de452f6cff5e2c1..d129187c88a36c66f81de05d520f797344edeb4c 100644 (file)
@@ -277,7 +277,7 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor {
                        
                        if ($paragraph->firstChild && $paragraph->firstChild->nodeType === XML_TEXT_NODE) {
                                $oldNode = $paragraph->firstChild;
-                               $newNode = $paragraph->ownerDocument->createTextNode(preg_replace('/^(\s|'.chr(226).chr(128).chr(175).'|'.chr(194).chr(160).')+/', '', $oldNode->textContent));
+                               $newNode = $paragraph->ownerDocument->createTextNode(preg_replace('/^[\p{Zs}\s]+/u', '', $oldNode->textContent));
                                $paragraph->insertBefore($newNode, $oldNode);
                                $paragraph->removeChild($oldNode);
                                
@@ -285,7 +285,7 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor {
                        
                        if ($paragraph->lastChild && $paragraph->lastChild->nodeType === XML_TEXT_NODE) {
                                $oldNode = $paragraph->lastChild;
-                               $newNode = $paragraph->ownerDocument->createTextNode(preg_replace('/(\s|'.chr(226).chr(128).chr(175).'|'.chr(194).chr(160).')+$/', '', $oldNode->textContent));
+                               $newNode = $paragraph->ownerDocument->createTextNode(preg_replace('/[\p{Zs}\s]+$/u', '', $oldNode->textContent));
                                $paragraph->insertBefore($newNode, $oldNode);
                                $paragraph->removeChild($oldNode);