Page MenuHomePhabricator

ParserFunctions: bad exponentiation syntax should raise an error
Open, LowPublic

Description

Mwlib seemed to be unable to handle the following:

{{#expr:(1E5round0)E5}}

Which wasn't too surprising, as this should really already make parser functions throw a syntax error.

Testcase: https://en.wikipedia.org/wiki/User:WOSlinker/list

Details

Reference
bz40087

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:10 AM
bzimport set Reference to bz40087.
bzimport added a subscriber: Unknown Object (MLST).

Filed upstream (i think it's number is 3546)

Ruslik00 wrote:

In fact an error appears in any expression that contains parentheses () before E operator: {{#expr:(1)E5}}. It can be fixed by inserting multiplication: {{#expr:(1)*1E5}}.

ralf_wikimedia wrote:

really guys, e shouldn't be an operator. this is just braindamaged.

thinks like "e e e" and "1e2e5" should raise a syntax error. the current mediawiki version evaluates them happily. wtf!

I've implemented that in mwlib.

I'm setting the component to ParserFunctions, since this issue should really be fixed there.

please read https://en.wikipedia.org/wiki/Scientific_notation

sumanah wrote:

Pinging Umherirrender in case you want to make an attempt at fixing this issue in ParserFunctions.

TheDJ removed a project: Upstream.
TheDJ set Security to None.
TheDJ removed a subscriber: Unknown Object (MLST).

the value E is defined as EXPR_EXPONENT in Expr.php I think due to which it is even the expressions given above are being executed. This is given as one of the expression parsers I think to remove this would fix the issue of giving the error on using e? correct me if I am wrong