Page MenuHomePhabricator

parserTests.php fails when l10n_cache is populated
Closed, ResolvedPublic

Description

Author: avarab

Description:
I'm unable to find out why this is happening. At first I thought it had something to do with the l10n cache but running
maintenance/rebuildLocalisationCache.php didn't change anything:

avar@aoeu:~/mw$ php maintenance/parserTests.php
php maintenance/parserTests.php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/gd.so' - /usr/lib/php5/20060613+lfs/gd.so: cannot open shared object \
file: No such file or directory in Unknown on line 0
This is MediaWiki version 1.16alpha(r52869).

Reading tests from "maintenance/parserTests.txt"...
"" is not a valid magic thingie for "redirect"
"" is not a valid magic thingie for "int"
"" is not a valid magic thingie for "ns"
"" is not a valid magic thingie for "urlencode"
"" is not a valid magic thingie for "lcfirst"
"" is not a valid magic thingie for "ucfirst"
"" is not a valid magic thingie for "lc"
"" is not a valid magic thingie for "uc"
"" is not a valid magic thingie for "localurl"
"" is not a valid magic thingie for "localurle"
"" is not a valid magic thingie for "fullurl"
"" is not a valid magic thingie for "fullurle"
"" is not a valid magic thingie for "formatnum"
"" is not a valid magic thingie for "grammar"
"" is not a valid magic thingie for "gender"
"" is not a valid magic thingie for "plural"
"" is not a valid magic thingie for "numberofpages"
"" is not a valid magic thingie for "numberofusers"
"" is not a valid magic thingie for "numberofactiveusers"
"" is not a valid magic thingie for "numberofarticles"
"" is not a valid magic thingie for "numberoffiles"
"" is not a valid magic thingie for "numberofadmins"
"" is not a valid magic thingie for "numberingroup"
"" is not a valid magic thingie for "numberofedits"
"" is not a valid magic thingie for "numberofviews"
"" is not a valid magic thingie for "language"
"" is not a valid magic thingie for "padleft"
"" is not a valid magic thingie for "padright"
"" is not a valid magic thingie for "anchorencode"
"" is not a valid magic thingie for "special"
"" is not a valid magic thingie for "defaultsort"
"" is not a valid magic thingie for "filepath"
"" is not a valid magic thingie for "pagesincategory"
"" is not a valid magic thingie for "pagesize"
"" is not a valid magic thingie for "protectionlevel"
"" is not a valid magic thingie for "namespace"
"" is not a valid magic thingie for "namespacee"
"" is not a valid magic thingie for "talkspace"
"" is not a valid magic thingie for "talkspacee"
"" is not a valid magic thingie for "subjectspace"
"" is not a valid magic thingie for "subjectspacee"
"" is not a valid magic thingie for "pagename"
"" is not a valid magic thingie for "pagenamee"
"" is not a valid magic thingie for "fullpagename"
"" is not a valid magic thingie for "fullpagenamee"
"" is not a valid magic thingie for "basepagename"
"" is not a valid magic thingie for "basepagenamee"
"" is not a valid magic thingie for "subpagename"
"" is not a valid magic thingie for "subpagenamee"
"" is not a valid magic thingie for "talkpagename"
"" is not a valid magic thingie for "talkpagenamee"
"" is not a valid magic thingie for "subjectpagename"
"" is not a valid magic thingie for "subjectpagenamee"
"" is not a valid magic thingie for "tag"
"" is not a valid magic thingie for "formatdate"
"" is not a valid magic thingie for "displaytitle"
"" is not a valid magic thingie for "toc"
"" is not a valid magic thingie for "notoc"
"" is not a valid magic thingie for "nogallery"
"" is not a valid magic thingie for "forcetoc"
"" is not a valid magic thingie for "noeditsection"
"" is not a valid magic thingie for "newsectionlink"
"" is not a valid magic thingie for "nonewsectionlink"
"" is not a valid magic thingie for "hiddencat"
"" is not a valid magic thingie for "index"
"" is not a valid magic thingie for "noindex"
"" is not a valid magic thingie for "staticredirect"
MagicWordArray::parseMatch: parameter not found
Backtrace:
#0 /home/avar/src/mw/trunk/phase3/includes/MagicWord.php(665): MagicWordArray->parseMatch(Array)
#1 /home/avar/src/mw/trunk/phase3/includes/parser/Parser.php(3360): MagicWordArray->matchAndRemove('<!--MWTOC-->bla...')
#2 /home/avar/src/mw/trunk/phase3/includes/parser/Parser.php(888): Parser->doDoubleUnderscore('blah blah')
#3 /home/avar/src/mw/trunk/phase3/includes/parser/Parser.php(327): Parser->internalParse('blah blah')
#4 /home/avar/src/mw/trunk/phase3/includes/Article.php(2946): Parser->parse('blah blah', Object(Title), Object(ParserOptions), true, true, NULL)
#5 /home/avar/src/mw/trunk/phase3/includes/Article.php(1644): Article->prepareTextForEdit('blah blah')
#6 /home/avar/src/mw/trunk/phase3/includes/Article.php(1491): Article->doEdit('blah blah', '', 97)
#7 /home/avar/src/mw/trunk/phase3/maintenance/parserTests.inc(1022): Article->insertNewArticle('blah blah', '', false, false)
#8 /home/avar/src/mw/trunk/phase3/maintenance/parserTests.inc(307): ParserTest->addArticle('Main Page', 'blah blah', 34)
#9 /home/avar/src/mw/trunk/phase3/maintenance/parserTests.inc(273): ParserTest->runFile('/home/avar/src/...')
#10 /home/avar/src/mw/trunk/phase3/maintenance/parserTests.php(75): ParserTest->runTestsFromFiles(Array)
#11 {main}


Version: 1.16.x
Severity: blocker

Details

Reference
bz19574

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:40 PM
bzimport set Reference to bz19574.

avarab wrote:

I've found that this happens when the l10n_cache is populated in the DB. Steps to reproduce:

mysql> truncate l10n_cache;
Query OK, 2809 rows affected (0.05 sec)

$ php maintenance/parserTests.php
php maintenance/parserTests.php
This is MediaWiki version 1.16alpha(r52932).

Reading tests from "maintenance/parserTests.txt"...
Running test Blank input... PASSED
Running test Simple paragraph... PASSED
Running test Simple list... PASSED
Running test Italics and bold... PASSED
[.. the other tests run normally ..]

Running the parsertests populates the l10n_cache:

mysql> select count(*) from l10n_cache;
+----------+

count(*)

+----------+

2741

+----------+
1 row in set (0.01 sec)

Including the magicwords:

mysql> select length(lc_value) from l10n_cache where lc_lang = 'en' and lc_key = 'magicWords';
+------------------+

length(lc_value)

+------------------+

8110

+------------------+
1 row in set (0.00 sec)

But now running the tests again gives the same error:

avar@aoeu:~/mw$ php maintenance/parserTests.php
php maintenance/parserTests.php
This is MediaWiki version 1.16alpha(r52932).

Reading tests from "maintenance/parserTests.txt"...
"" is not a valid magic thingie for "redirect"
"" is not a valid magic thingie for "int"
"" is not a valid magic thingie for "ns"

And changing to a filecache works around the problem:

$wgCacheDirectory = "$IP/cache/";

avar@aoeu:~/mw$ php maintenance/parserTests.php
php maintenance/parserTests.php
This is MediaWiki version 1.16alpha(r52932).

Reading tests from "maintenance/parserTests.txt"...
Running test Blank input... PASSED
Running test Simple paragraph... PASSED
Running test Simple list... PASSED

avarab wrote:

This is what I get when I manually unserialize the contents of the DB, looks normal:

avar@aoeu:~/src/mw/trunk/phase3/includes$ echo "select lc_value from l10n_cache where lc_lang = 'en' and lc_key = 'magicWords';" | mysql -N --user=wikiuser --password=wikiuser wikidb | php -r '$in = ""; if ($fp=fopen("php://stdin","r")) { while (!feof($fp)) { $line = fgets($fp,4096); $in .= $line; } }; print_r(unserialize($in));'
Array
(

[redirect] => Array
    (
        [0] => 0
        [1] => #REDIRECT
    )

[notoc] => Array
    (
        [0] => 0
        [1] => __NOTOC__
    )

[nogallery] => Array
    (
        [0] => 0
        [1] => __NOGALLERY__
    )

[forcetoc] => Array
    (
        [0] => 0
        [1] => __FORCETOC__
    )

[toc] => Array
    (
        [0] => 0
        [1] => __TOC__
    )

[noeditsection] => Array
    (
        [0] => 0
        [1] => __NOEDITSECTION__
    )

[noheader] => Array
    (
        [0] => 0
        [1] => __NOHEADER__
    )

[currentmonth] => Array
    (
        [0] => 1
        [1] => CURRENTMONTH
        [2] => CURRENTMONTH2
    )

[currentmonth1] => Array
    (
        [0] => 1
        [1] => CURRENTMONTH1
    )

[currentmonthname] => Array
    (
        [0] => 1
        [1] => CURRENTMONTHNAME
    )

[currentmonthnamegen] => Array
    (
        [0] => 1
        [1] => CURRENTMONTHNAMEGEN
    )

[currentmonthabbrev] => Array
    (
        [0] => 1
        [1] => CURRENTMONTHABBREV
    )

[currentday] => Array
    (
        [0] => 1
        [1] => CURRENTDAY
    )

[currentday2] => Array
    (
        [0] => 1
        [1] => CURRENTDAY2
    )

[currentdayname] => Array
    (
        [0] => 1
        [1] => CURRENTDAYNAME
    )

[currentyear] => Array
    (
        [0] => 1
        [1] => CURRENTYEAR
    )

[currenttime] => Array
    (
        [0] => 1
        [1] => CURRENTTIME
    )

[currenthour] => Array
    (
        [0] => 1
        [1] => CURRENTHOUR
    )

[localmonth] => Array
    (
        [0] => 1
        [1] => LOCALMONTH
        [2] => LOCALMONTH2
    )

[localmonth1] => Array
    (
        [0] => 1
        [1] => LOCALMONTH1
    )

[localmonthname] => Array
    (
        [0] => 1
        [1] => LOCALMONTHNAME
    )

[localmonthnamegen] => Array
    (
        [0] => 1
        [1] => LOCALMONTHNAMEGEN
    )

[localmonthabbrev] => Array
    (
        [0] => 1
        [1] => LOCALMONTHABBREV
    )

[localday] => Array
    (
        [0] => 1
        [1] => LOCALDAY
    )

[localday2] => Array
    (
        [0] => 1
        [1] => LOCALDAY2
    )

[localdayname] => Array
    (
        [0] => 1
        [1] => LOCALDAYNAME
    )

[localyear] => Array
    (
        [0] => 1
        [1] => LOCALYEAR
    )

[localtime] => Array
    (
        [0] => 1
        [1] => LOCALTIME
    )

[localhour] => Array
    (
        [0] => 1
        [1] => LOCALHOUR
    )

[numberofpages] => Array
    (
        [0] => 1
        [1] => NUMBEROFPAGES
    )

[numberofarticles] => Array
    (
        [0] => 1
        [1] => NUMBEROFARTICLES
    )

[numberoffiles] => Array
    (
        [0] => 1
        [1] => NUMBEROFFILES
    )

[numberofusers] => Array
    (
        [0] => 1
        [1] => NUMBEROFUSERS
    )

[numberofactiveusers] => Array
    (
        [0] => 1
        [1] => NUMBEROFACTIVEUSERS
    )

[numberofedits] => Array
    (
        [0] => 1
        [1] => NUMBEROFEDITS
    )

[numberofviews] => Array
    (
        [0] => 1
        [1] => NUMBEROFVIEWS
    )

[pagename] => Array
    (
        [0] => 1
        [1] => PAGENAME
    )

[pagenamee] => Array
    (
        [0] => 1
        [1] => PAGENAMEE
    )

[namespace] => Array
    (
        [0] => 1
        [1] => NAMESPACE
    )

[namespacee] => Array
    (
        [0] => 1
        [1] => NAMESPACEE
    )

[talkspace] => Array
    (
        [0] => 1
        [1] => TALKSPACE
    )

[talkspacee] => Array
    (
        [0] => 1
        [1] => TALKSPACEE
    )

[subjectspace] => Array
    (
        [0] => 1
        [1] => SUBJECTSPACE
        [2] => ARTICLESPACE
    )

[subjectspacee] => Array
    (
        [0] => 1
        [1] => SUBJECTSPACEE
        [2] => ARTICLESPACEE
    )

[fullpagename] => Array
    (
        [0] => 1
        [1] => FULLPAGENAME
    )

[fullpagenamee] => Array
    (
        [0] => 1
        [1] => FULLPAGENAMEE
    )

[subpagename] => Array
    (
        [0] => 1
        [1] => SUBPAGENAME
    )

[subpagenamee] => Array
    (
        [0] => 1
        [1] => SUBPAGENAMEE
    )

[basepagename] => Array
    (
        [0] => 1
        [1] => BASEPAGENAME
    )

[basepagenamee] => Array
    (
        [0] => 1
        [1] => BASEPAGENAMEE
    )

[talkpagename] => Array
    (
        [0] => 1
        [1] => TALKPAGENAME
    )

[talkpagenamee] => Array
    (
        [0] => 1
        [1] => TALKPAGENAMEE
    )

[subjectpagename] => Array
    (
        [0] => 1
        [1] => SUBJECTPAGENAME
        [2] => ARTICLEPAGENAME
    )

[subjectpagenamee] => Array
    (
        [0] => 1
        [1] => SUBJECTPAGENAMEE
        [2] => ARTICLEPAGENAMEE
    )

[msg] => Array
    (
        [0] => 0
        [1] => MSG:
    )

[subst] => Array
    (
        [0] => 0
        [1] => SUBST:
    )

[msgnw] => Array
    (
        [0] => 0
        [1] => MSGNW:
    )

[img_thumbnail] => Array
    (
        [0] => 1
        [1] => thumbnail
        [2] => thumb
    )

[img_manualthumb] => Array
    (
        [0] => 1
        [1] => thumbnail=$1
        [2] => thumb=$1
    )

[img_right] => Array
    (
        [0] => 1
        [1] => right
    )

[img_left] => Array
    (
        [0] => 1
        [1] => left
    )

[img_none] => Array
    (
        [0] => 1
        [1] => none
    )

[img_width] => Array
    (
        [0] => 1
        [1] => $1px
    )

[img_center] => Array
    (
        [0] => 1
        [1] => center
        [2] => centre
    )

[img_framed] => Array
    (
        [0] => 1
        [1] => framed
        [2] => enframed
        [3] => frame
    )

[img_frameless] => Array
    (
        [0] => 1
        [1] => frameless
    )

[img_page] => Array
    (
        [0] => 1
        [1] => page=$1
        [2] => page $1
    )

[img_upright] => Array
    (
        [0] => 1
        [1] => upright
        [2] => upright=$1
        [3] => upright $1
    )

[img_border] => Array
    (
        [0] => 1
        [1] => border
    )

[img_baseline] => Array
    (
        [0] => 1
        [1] => baseline
    )

[img_sub] => Array
    (
        [0] => 1
        [1] => sub
    )

[img_super] => Array
    (
        [0] => 1
        [1] => super
        [2] => sup
    )

[img_top] => Array
    (
        [0] => 1
        [1] => top
    )

[img_text_top] => Array
    (
        [0] => 1
        [1] => text-top
    )

[img_middle] => Array
    (
        [0] => 1
        [1] => middle
    )

[img_bottom] => Array
    (
        [0] => 1
        [1] => bottom
    )

[img_text_bottom] => Array
    (
        [0] => 1
        [1] => text-bottom
    )

[img_link] => Array
    (
        [0] => 1
        [1] => link=$1
    )

[img_alt] => Array
    (
        [0] => 1
        [1] => alt=$1
    )

[int] => Array
    (
        [0] => 0
        [1] => INT:
    )

[sitename] => Array
    (
        [0] => 1
        [1] => SITENAME
    )

[ns] => Array
    (
        [0] => 0
        [1] => NS:
    )

[localurl] => Array
    (
        [0] => 0
        [1] => LOCALURL:
    )

[localurle] => Array
    (
        [0] => 0
        [1] => LOCALURLE:
    )

[server] => Array
    (
        [0] => 0
        [1] => SERVER
    )

[servername] => Array
    (
        [0] => 0
        [1] => SERVERNAME
    )

[scriptpath] => Array
    (
        [0] => 0
        [1] => SCRIPTPATH
    )

[grammar] => Array
    (
        [0] => 0
        [1] => GRAMMAR:
    )

[gender] => Array
    (
        [0] => 0
        [1] => GENDER:
    )

[notitleconvert] => Array
    (
        [0] => 0
        [1] => __NOTITLECONVERT__
        [2] => __NOTC__
    )

[nocontentconvert] => Array
    (
        [0] => 0
        [1] => __NOCONTENTCONVERT__
        [2] => __NOCC__
    )

[currentweek] => Array
    (
        [0] => 1
        [1] => CURRENTWEEK
    )

[currentdow] => Array
    (
        [0] => 1
        [1] => CURRENTDOW
    )

[localweek] => Array
    (
        [0] => 1
        [1] => LOCALWEEK
    )

[localdow] => Array
    (
        [0] => 1
        [1] => LOCALDOW
    )

[revisionid] => Array
    (
        [0] => 1
        [1] => REVISIONID
    )

[revisionday] => Array
    (
        [0] => 1
        [1] => REVISIONDAY
    )

[revisionday2] => Array
    (
        [0] => 1
        [1] => REVISIONDAY2
    )

[revisionmonth] => Array
    (
        [0] => 1
        [1] => REVISIONMONTH
    )

[revisionyear] => Array
    (
        [0] => 1
        [1] => REVISIONYEAR
    )

[revisiontimestamp] => Array
    (
        [0] => 1
        [1] => REVISIONTIMESTAMP
    )

[revisionuser] => Array
    (
        [0] => 1
        [1] => REVISIONUSER
    )

[plural] => Array
    (
        [0] => 0
        [1] => PLURAL:
    )

[fullurl] => Array
    (
        [0] => 0
        [1] => FULLURL:
    )

[fullurle] => Array
    (
        [0] => 0
        [1] => FULLURLE:
    )

[lcfirst] => Array
    (
        [0] => 0
        [1] => LCFIRST:
    )

[ucfirst] => Array
    (
        [0] => 0
        [1] => UCFIRST:
    )

[lc] => Array
    (
        [0] => 0
        [1] => LC:
    )

[uc] => Array
    (
        [0] => 0
        [1] => UC:
    )

[raw] => Array
    (
        [0] => 0
        [1] => RAW:
    )

[displaytitle] => Array
    (
        [0] => 1
        [1] => DISPLAYTITLE
    )

[rawsuffix] => Array
    (
        [0] => 1
        [1] => R
    )

[newsectionlink] => Array
    (
        [0] => 1
        [1] => __NEWSECTIONLINK__
    )

[nonewsectionlink] => Array
    (
        [0] => 1
        [1] => __NONEWSECTIONLINK__
    )

[currentversion] => Array
    (
        [0] => 1
        [1] => CURRENTVERSION
    )

[urlencode] => Array
    (
        [0] => 0
        [1] => URLENCODE:
    )

[anchorencode] => Array
    (
        [0] => 0
        [1] => ANCHORENCODE
    )

[currenttimestamp] => Array
    (
        [0] => 1
        [1] => CURRENTTIMESTAMP
    )

[localtimestamp] => Array
    (
        [0] => 1
        [1] => LOCALTIMESTAMP
    )

[directionmark] => Array
    (
        [0] => 1
        [1] => DIRECTIONMARK
        [2] => DIRMARK
    )

[language] => Array
    (
        [0] => 0
        [1] => #LANGUAGE:
    )

[contentlanguage] => Array
    (
        [0] => 1
        [1] => CONTENTLANGUAGE
        [2] => CONTENTLANG
    )

[pagesinnamespace] => Array
    (
        [0] => 1
        [1] => PAGESINNAMESPACE:
        [2] => PAGESINNS:
    )

[numberofadmins] => Array
    (
        [0] => 1
        [1] => NUMBEROFADMINS
    )

[formatnum] => Array
    (
        [0] => 0
        [1] => FORMATNUM
    )

[padleft] => Array
    (
        [0] => 0
        [1] => PADLEFT
    )

[padright] => Array
    (
        [0] => 0
        [1] => PADRIGHT
    )

[special] => Array
    (
        [0] => 0
        [1] => special
    )

[defaultsort] => Array
    (
        [0] => 1
        [1] => DEFAULTSORT:
        [2] => DEFAULTSORTKEY:
        [3] => DEFAULTCATEGORYSORT:
    )

[filepath] => Array
    (
        [0] => 0
        [1] => FILEPATH:
    )

[tag] => Array
    (
        [0] => 0
        [1] => tag
    )

[hiddencat] => Array
    (
        [0] => 1
        [1] => __HIDDENCAT__
    )

[pagesincategory] => Array
    (
        [0] => 1
        [1] => PAGESINCATEGORY
        [2] => PAGESINCAT
    )

[pagesize] => Array
    (
        [0] => 1
        [1] => PAGESIZE
    )

[index] => Array
    (
        [0] => 1
        [1] => __INDEX__
    )

[noindex] => Array
    (
        [0] => 1
        [1] => __NOINDEX__
    )

[numberingroup] => Array
    (
        [0] => 1
        [1] => NUMBERINGROUP
        [2] => NUMINGROUP
    )

[staticredirect] => Array
    (
        [0] => 1
        [1] => __STATICREDIRECT__
    )

[protectionlevel] => Array
    (
        [0] => 1
        [1] => PROTECTIONLEVEL
    )

[formatdate] => Array
    (
        [0] => 0
        [1] => formatdate
        [2] => dateformat
    )

)
avar@aoeu:~/src/mw/trunk/phase3/includes$

Assigning to Tim, l10ncache is his baby.

Marking this one as a blocker, as I really want to get automated runs of the tests going and it kind of sucks when they don't work. :)