mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-26 20:35:21 +01:00
BigInteger: backport GMP fixes from master branch
This commit is contained in:
parent
8b76e96b83
commit
677ae387b0
@ -441,7 +441,7 @@ class Math_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';
|
||||
}
|
||||
|
||||
|
@ -414,5 +414,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');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user