Page MenuHomePhabricator

conditional operator with () returns false
Closed, ResolvedPublic

Description

Author: aokomoriuta

Description:
Conditional operators doesn't work well.

"(1 == 1) ? true : false" returns true,
but "(1 == 1) ? (true) : (false)" return false.

And also "if (1==1) then (true) else (false) end" return false, too.


Version: unspecified
Severity: major

Details

Reference
bz25373

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:21 PM
bzimport added a project: AbuseFilter.
bzimport set Reference to bz25373.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 11254
Patch to fix the short circuit activation for "if/then/else" evaluation

It looks like ShortCircuit is enabled for the wrong branch of the condition in doLevelConditions (i.e. the branch used to compute the result is skipped, except for very simple cases). Here is a patch.

Attached:

Thanks for the patch, can you directly submit your patch to gerrit so others can review it easier?

http://www.mediawiki.org/wiki/Gerrit

Hi Nischay,
Sorry but I will not send patches for MediaWiki anymore, and I don't want to learn gerrit just for the two patches I have already proposed.

Just a note aside: I spoke with orlodrim@ and he explained that his reasons to leave are personal and not related to this bug report. He will indeed not push this patch to Gerrit.

orlodrim, best wishes in your new projects! Maybe one day we'll see you around again.

https://gerrit.wikimedia.org/r/55493 (Gerrit Change I2f2524731098f323e61bbc0442e7b56b11cdea37) | change APPROVED and MERGED [by jenkins-bot]

Chris merged the change yesterday.