Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2019-05-26 15:38:34 -05:00
commit 3ca5b88d58
2 changed files with 4 additions and 1 deletions

View File

@ -445,7 +445,7 @@ 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)) {
if (!strlen($x) || $x == '-') {
$x = '0';
}

View File

@ -411,5 +411,8 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
{
$temp = $this->getInstance('00');
$this->assertSame($temp->toString(), '0');
$temp = $this->getInstance('-0');
$this->assertSame($temp->toString(), '0');
}
}