From 8efa1bd79c36ade463fafc0dfff3876d8ba43f7d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 14 Nov 2019 14:09:39 +0100 Subject: [PATCH] Incorrect handling of comments after the page id Fixes #3106 --- .../object/PageMessageEmbeddedObjectHandler.class.php | 6 ++++++ 1 file changed, 6 insertions(+) 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); }); -- 2.20.1