Addshore has uploaded a new change for review.

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

Change subject: Fix potential bug with int category names
......................................................................

Fix potential bug with int category names

Instead of potentially breaking things by
Category:2015 for example appearing as int 2015
cast everything to a string (which is expected
of a category name)...

Change-Id: I48fe3641fcd40d6437dfd4b55c78a150e85346bb
---
M AutoCreateCategoryPages.body.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AutoCreateCategoryPages 
refs/changes/82/256682/1

diff --git a/AutoCreateCategoryPages.body.php b/AutoCreateCategoryPages.body.php
index 4aa4fbc..6860090 100644
--- a/AutoCreateCategoryPages.body.php
+++ b/AutoCreateCategoryPages.body.php
@@ -33,7 +33,9 @@
                // Extract the categories on this page
                //$article->getParserOptions();
                $page_cats = $article->getParserOutput( 
$article->makeParserOptions( $user ) )->getCategories();
-               $page_cats = array_keys( $page_cats );  // Because we get a 
lame array back
+               // array keys will cast numeric category names to ints
+               // so we need to cast them back to strings to avoid potentially 
breaking things!
+               $page_cats = array_map( 'strval', array_keys( $page_cats ) );
                $existing_cats = self::getExistingCategories();
                
                // Determine which categories on page do not exist

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48fe3641fcd40d6437dfd4b55c78a150e85346bb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AutoCreateCategoryPages
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

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

Reply via email to