Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2019-05-26 11:42:01 -05:00
commit 77ffe153a0
2 changed files with 9 additions and 0 deletions

View File

@ -445,6 +445,9 @@ class BigInteger
// (?<=^|-)0*: find any 0's that are preceded by the start of the string or by a - (ie. octals)
// [^-0-9].*: find any non-numeric characters and then any characters that follow that
$x = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x);
if (!strlen($x)) {
$x = '0';
}
switch (MATH_BIGINTEGER_MODE) {
case self::MODE_GMP:

View File

@ -403,4 +403,10 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
$temp = $this->getInstance(48);
$this->assertSame($temp->toHex(true), '30');
}
public function testZeroBase10()
{
$temp = $this->getInstance('00');
$this->assertSame($temp->toString(), '0');
}
}