Add parser functions #timef and #timefl, giving access to the standard
date/time formats of any language.
StubObject::unstub() is no longer required since the user language is
unstubbed in ParserOptions::__construct().
Bug: T223772
Change-Id: If158f45aad67ff017f9cd15889915b226e03f50c
These are edge-cases we should make sure are covered so we don't
accidentally change how they behave.
Change-Id: Iddd08a7e752ad1fe813ed42b665e4f656c9f516c
It's impossible that explode() returns an empty array. This is dead
code.
Also add tests for the previously untested #titleparts function to
make sure this patch doesn't change any behavior. Including weird
usages with negative numbers.
Change-Id: Ib0d2503fdb0900bf6db3ebbc26d2ff648dbfc86d
Had to change a bit how ExprError is used, to prevent having to turn unit
tests into ingergation tests, adding 5 seconds to run time.
Change-Id: Id4e158f3a4418d320b1c0bdac834ebbba03762af
The mb_strpos() function throws E_WARNING if the offset is longer
than the length of the string.
Bug: T209600
Change-Id: Ib4296ba136eaf5c8461681e9d5f108118b2494f4
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: Iaa65f1987144baffd480d082538547fc9cf2c15b
In trying to fix bug 35866, I32c9eca6 changed the behavior of 'mod' to
no longer cast its arguments to integers, which conventiently also
solved bug 6068. However, this also broke many existing uses that
depended on that casting.
This change reverts 'mod' to its old behavior while still solving bug
35866, and at the same time adds a new 'fmod' operator with the new
behavior to keep bug 6068 fixed as well.
Change-Id: I6114c6e769119e6ced61b3b55b6f70b03b5b1ebe
The PHP modulo operator ('%') casts its operands to ints, causing
floating point values 0 < $right < 1 to raise a divide-by-zero error.
Explicitly casting both operands to float and using fnmod() resolves the
issue. This change also tidies up the check for zero values and adds
tests.
Change-Id: I32c9eca6552e4fec248eb4fa6419faa39c10df3b