Page MenuHomePhabricator

MagicNoNumberedHeadings accesses a private member in 1.26, crashes on Special:Version
Closed, DeclinedPublic


Install the MagicNoNumberedHeadings extension in MediaWiki 1.26. It crashes when you hit Special:Version with the error:

Fatal error: Cannot access private property ParserOptions::$mNumberHeadings in /var/www/html/w/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php on line 59

The problem is easily fixed by this patch:

diff --git a/wiki/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php b/wiki/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php
index 54cf267..53ae97b 100644
--- a/wiki/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php
+++ b/wiki/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php
@@ -56,7 +56,7 @@ $wgHooks['ParserBeforeInternalParse'][] = 'MagicNoNumberedHeadingsParserBeforeIn
 function MagicNoNumberedHeadingsParserBeforeInternalParse( &$parser, &$text, $stripState )
        if (MagicWord::get( 'MAG_NONUMBEREDHEADINGS' )->matchAndRemove( $text ) ) {
-               $parser->mOptions->mNumberHeadings = (FALSE);
+               $parser->mOptions->setNumberHeadings(false);
        return true;

Event Timeline

maiden_taiwan raised the priority of this task from to Needs Triage.
maiden_taiwan updated the task description. (Show Details)
maiden_taiwan added a subscriber: maiden_taiwan.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 7 2015, 5:24 PM

Thanks for taking a look at the code!

You are very welcome to use developer access to submit this as a Git branch directly into Gerrit which makes it easier to review it quickly.
If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

I just spent 30 frustrating minutes trying to use the Gerrit Patch Uploader. Apparently it requires me to clone the repository containing MagicNoNumberedHeadings, rather than work from tar files (which is how I interact with MediaWiki). Otherwise it doesn't like the file paths in the patch, I think, and rejects the patch.

I can't even find that repository to clone it. was no help. If someone could provide me with the precise clone command, I can upload this patch.

@maiden_taiwan: I am sorry for any frustration I might have created by my comment. Looking at I see now that it links to (nowadays read-only) SVN which was superseded by Git. I'm afraid the code repository was not imported into Git due to missing activity.

CC'ing the listed extension maintainer @Purodha - if this repository should be in Git, it can be requested in

@Aklapper: Thank you very much.

Mnn, as the author of this extension @Purodha is deceased, decline?

Why not just apply the one-line patch? The change is simple & obvious.

Why not just apply the one-line patch? The change is simple & obvious. documentation told me: "Release status: unmaintained", so even you submit a patch it's likely to be abandoned by sysadmin, see e.g.

TTO closed this task as Declined.Jan 3 2017, 5:27 AM
TTO added a subscriber: TTO.

The code for this extension is still in SVN, so can't even be modified - there's not much we can do to solve this bug.

If you are interested in taking on the task of developing and maintaining this extension, you can request that the extension be imported into Git.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptJan 3 2017, 5:27 AM