r104174 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104173‎ | r104174 | r104175 >
Date:15:54, 24 November 2011
Author:danwe
Status:deferred
Tags:
Comment:
1.4 alpha bug solved, '#arraysearcharray' with empty string as start index was interpreted as 0
Modified paths:
  • /trunk/extensions/Arrays/Arrays.php (modified) (history)
  • /trunk/extensions/Arrays/RELEASE-NOTES (modified) (history)

Diff [purge]

Index: trunk/extensions/Arrays/RELEASE-NOTES
@@ -17,6 +17,7 @@
1818 + See 1.4 alpha for previous changes
1919 - If 'Regex Fun' extension is installed, '#arraysearcharray' can use Regex Funs 'e' flag feature
2020 for transforming the result and at the same time parsing them after each back-reference inclusion.
 21+ - 1.4 alpha bug solved, '#arraysearcharray' with empty string as start index was interpreted as 0
2122
2223
2324 * November 20, 2001 -- Version 1.4 alpha (r103716)
Index: trunk/extensions/Arrays/Arrays.php
@@ -472,7 +472,7 @@
473473 $arrayId = null,
474474 $needle = '/^(\s*)$/',
475475 $index = 0,
476 - $limit = -1,
 476+ $limit = '',
477477 $transform = ''
478478 ) {
479479 $store = self::get( $parser );
@@ -496,8 +496,8 @@
497497 return '';
498498 }
499499
500 - // non-numeric limit will be set to 0
501 - $limit = (int)$limit;
 500+ // non-numeric limit will be set to 0, except limit was omitted ('')
 501+ $limit = $limit === '' ? -1 : (int)$limit;
502502 if( $limit === 0 ) {
503503 return '';
504504 }

Status & tagging log