From: Alexander Ebert Date: Thu, 14 Nov 2019 13:09:39 +0000 (+0100) Subject: Incorrect handling of comments after the page id X-Git-Tag: 5.2.0_Beta_3~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8efa1bd79c36ade463fafc0dfff3876d8ba43f7d;p=GitHub%2FWoltLab%2FWCF.git Incorrect handling of comments after the page id Fixes #3106 --- diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/PageMessageEmbeddedObjectHandler.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/PageMessageEmbeddedObjectHandler.class.php index 32501b6a17..1234260d12 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/PageMessageEmbeddedObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/PageMessageEmbeddedObjectHandler.class.php @@ -3,6 +3,7 @@ namespace wcf\system\message\embedded\object; use wcf\data\page\Page; use wcf\data\page\PageCache; use wcf\system\html\input\HtmlInputProcessor; +use wcf\util\ArrayUtil; /** * Parses embedded pages and outputs their link or title. @@ -47,6 +48,11 @@ class PageMessageEmbeddedObjectHandler extends AbstractSimpleMessageEmbeddedObje * @inheritDoc */ public function validateValues($objectType, $objectID, array $values) { + // Pages can be referenced as `123#Some Text`, where everything after the number + // is a comment for better readability. Converting the values to integers via + // `intval()` will discard the everything after the ID. + $values = ArrayUtil::toIntegerArray($values); + return array_filter($values, function($value) { return (PageCache::getInstance()->getPage($value) !== null); });