Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/148533

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/33/148533/1

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: newchange
Gerrit-Change-Id: I5df84e50fd983ec286241549c16fbea07c541839
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>

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

Reply via email to