gnosygnu / xowa

xowa offline wiki application
Other
374 stars 41 forks source link

invoke failed: File:Balangiga_Bells.jpg {{#invoke:Formatnum|main}} #372

Closed desb42 closed 5 years ago

desb42 commented 5 years ago

looking at page commons.wikimedia.org/wiki/File:Balangiga_Bells.jpg the above error occurs twice

the following line is

[err 0] <gplx> @d:/des/xowa_x/bin/any/xowa/xtns/Scribunto/engines/Luaj/MWServer.lua:59 
vm error: gplx.Err: type mismatch: expdType=boolean actlType=java.lang.String actlObj=y

I have tracked this down by following the wikitext {{PD-old-1923}}

leads to commons.wikimedia.org/wiki/Template:PD-old-1923 redirecting to Template:PD-old-70-expired containing {{PD-old-X-1923|1={{{deathyear|{{{1|}}}}}}|X=70}}

leads to commons.wikimedia.org/wiki/Template:PD-old-X-1923 redirects to Template:PD-old-X-expired containing {{PD-1923-text|lang={{{lang|{{int:lang}}}}} }}

leads to commons.wikimedia.org/wiki/Template:PD-1923-text redirects to Template:PD-US-expired-text contains {{Formatnum|{{Not-PD-US-expired-min-year}}|arabic-indic|sep=1}} and {{Formatnum|{{Not-PD-US-expired-min-year}}|fa|sep=1}}

this is why the two errors occur However within Module:Formatnum the language code arabic-indic is replaced with fa so I suspect that this is only one issue

This strongly hints at a language related issue

gnosygnu commented 5 years ago

Based on this statement:

[err 0] <gplx> @d:/des/xowa_x/bin/any/xowa/xtns/Scribunto/engines/Luaj/MWServer.lua:59 
vm error: gplx.Err: type mismatch: expdType=boolean actlType=java.lang.String actlObj=y

This should be an "easy" item to track down. More likely than not, this is a bug in the XOWA side, which I should be able to find by enabling an error breakpoint in Eclipse.

Will report back tomorrow

gnosygnu commented 5 years ago

So, root cause was that Formatnum was passing in something like language.formatNum(1234, {noCommafy='y'}), and XOWA was choking on the y (it could only handle boolean)

It was a 1-line fix, but it took longer than expected as I had to put in full support for PHP's empty

Thanks again for all the details. It greatly helped in tracking down the problem quickly!

desb42 commented 5 years ago

Just tried it - works for me