jenkins-bot has submitted this change and it was merged.

Change subject: Fix valid category check during preview form.
......................................................................


Fix valid category check during preview form.

Previous check for '}' or '{' was insufficient. Due to a core bug,
passing an invalid category can cause a fatal. However we want to
catch the invalid categories anyways to show user a warning.

Bug: 68394
Change-Id: I5df84e50fd983ec286241549c16fbea07c541839
---
M includes/Forms/PreviewForm.php
1 file changed, 3 insertions(+), 6 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Forms/PreviewForm.php b/includes/Forms/PreviewForm.php
index 13ba9db..ac00573 100644
--- a/includes/Forms/PreviewForm.php
+++ b/includes/Forms/PreviewForm.php
@@ -294,12 +294,9 @@
                                // find this hacky, but not sure how to 
retrieve the raw text
                                $category = strip_tags( $category->getText() );
 
-                               // if the parser was not able to parse a 
template, {} will be left
-                               // only include the text if it no longer 
contains {}
-                               if (
-                                       strpos( $category, '{' ) === false &&
-                                       strpos( $category, '}' ) === false
-                               ) {
+                               // if the parser was not able to parse a 
template, {} will be left.
+                               // only include the text if valid category.
+                               if ( Title::makeTitleSafe( NS_CATEGORY, 
$category ) ) {
                                        $categories[$category] = 0;
                                } else {
                                        $notParsable[] = $category;

-- 
To view, visit https://gerrit.wikimedia.org/r/148533
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5df84e50fd983ec286241549c16fbea07c541839
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Dan-nl <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to