Page MenuHomePhabricator

NumerAlpha extension: PHP Notice: Undefined index: full level prefix in NumerAlpha.class.php on line 266
Closed, ResolvedPublic

Description

Setup

  • MediaWiki 1.27.5 (3e66859) 00:06, 21. Sep. 2018
  • PHP 7.0.33-0+deb9u1 (apache2handler)
  • MariaDB 10.1.37-MariaDB-0+deb9u1
  • NumerAlpha 0.7.0 PD

Issue

PHP Notice: Undefined index: full level prefix in /.../w/extensions/NumerAlpha/NumerAlpha.class.php on line 266

Caused by this revision which basically adds the {{#counter:}} parser function to the page.

Event Timeline

I cannot replicate this on 1.31.1 or 1.32.0. I tried creating a page with just the following content:

{{#counter: }}

{{#counter: }}

{{#counter: }}

Is that sufficient to cause the problem on 1.27?

Is that sufficient to cause the problem on 1.27?

No I am afraid not as my tests today reveal. I only know that the mentioned edit triggered it.

I don't understand. I don't see an error in the revision you linked.

I don't understand. I don't see an error in the revision you linked.

Well this edit caused the log to record the warning I reported. I do not know why.

Let's wait for @Revansx and his findings.

@Jamesmontalvo3 , I'm running Meza 31.8.2 and I'm still seeing this PHP Warning from certain pages when I run the refreshLinks maintenance script. It might be triggered by certain pages where the {{counter:}} function is being used, but it doesn't report which pages that is.

  • MediaWiki - 1.31.1 (a4c8065)
  • PHP - 7.1.30 (apache2handler)
  • NumerAlpha - 0.7.0 (a4c8065)

The issue seems to always occur when <in /> is called from a template and no specific named counter has been defined.

Imvuong provided a solution in the linked topic on MediaWiki.org, and I aggree with them: when full level prefix is not defined, it should be defined to the empty string, which is the default value in the powerful parser function {{counter:}}.

Another fix would be to call the method extractListOptions, but it would give the historical parser functions <in /> and friends the same power as {{counter:}}, I’m not sure it is really wanted here in a simple bug fix.

Change 915490 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/extensions/NumerAlpha@master] Fix PHP Notice Undefined index "full level prefix"

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

Change 915490 merged by Jaideraf:

[mediawiki/extensions/NumerAlpha@master] Fix PHP Notice Undefined index "full level prefix"

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

Pppery assigned this task to Seb35.
Pppery removed a project: Patch-For-Review.