Page MenuHomePhabricator

Magic word "PAGESINCATEGORY" with parameter "pages" returns negative value on zhwikibooks
Closed, InvalidPublic

Description

Steps to reproduce:

  1. Visit any page of zhwikibooks and edit (sandbox as an example)
  2. Replace the text in the input box with {{PAGESINCATEGORY:快速刪除候選|pages}}
  3. Preview and the result is -1

As the category 快速刪除候選 has two subcategories and no other pages, the result is supposed to be 0. I tried to purge the category but it did not work.

Event Timeline

(PAGESINCATEGORY is not part of the ParserFunctions extension, hence removing that project tag)

It is stored in the database:
https://zh.wikibooks.org/w/api.php?action=query&prop=categoryinfo&pageids=13169

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "13169": {
                "pageid": 13169,
                "ns": 14,
                "title": "Category:\u5feb\u901f\u522a\u9664\u5019\u9078",
                "categoryinfo": {
                    "size": 1,
                    "pages": -1,
                    "files": 0,
                    "subcats": 2
                }
            }
        }
    }
}

It seems the text "This category has the following 2 subcategories, out of 2 total. " on the category itself is ignoring negative values.

According to @A2093064 's advise I removed both of its subcategories and deleted that category to fix above glitch in database. After restoring again it seems working well so I'm closing it as invalid (if I'm making mistakes fell free to correct me).