To explain the problem, I created a module with a function that returns mw.title.getCurrentTitle().protectionLevels as a string: https://fr.wikipedia.org/wiki/Module:Orlodrim/ProtectionLevels
Steps to reproduce:
- Edit a page that does not exist on the French Wikipedia, for instance https://fr.wikipedia.org/w/index.php?title=ThisDoesNotExist14&action=edit
- Paste the following code: "{{#invoke:Orlodrim/ProtectionLevels|getprotection}}"
- Click on "Prévisualiser" ("Show preview").
Expected result: the preview shows an empty table "[]".
Actual result: the preview shows "[move=[1=autoconfirmed, ], edit=[1=autoconfirmed, ], ]".
If the page if saved, it will have the same content until it is edited again or purged.
The bug happens only with mw.title.getCurrentTitle() and not if the title object is created with mw.title.new (e.g. mw.title.new('ThisPageDoesNotExist').protectionLevels returns [] as expected).
If I follow the same steps on the French Wiktionary, I get a different but also unexpected result, namely "[move=[1=sysop, ], edit=[1=sysop, ], ]".
On a local installation of MediaWiki + Scribunto in luastandalone mode, I get "[move=[], edit=[], ]", which seems ok.
Context: The French Wikipedia uses Module:Documentation to display documentation pages of templates. This module automatically includes the "semi-protected page" template on semi-protected pages, and this template fills a tracking category when it is included into pages that are not semi-protected. The tracking category contains many new templates that have only one revision. This seems to be related.