mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-30 04:39:21 +01:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
3ca5b88d58
@ -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*: 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
|
// [^-0-9].*: find any non-numeric characters and then any characters that follow that
|
||||||
$x = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x);
|
$x = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x);
|
||||||
if (!strlen($x)) {
|
if (!strlen($x) || $x == '-') {
|
||||||
$x = '0';
|
$x = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,5 +411,8 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
|||||||
{
|
{
|
||||||
$temp = $this->getInstance('00');
|
$temp = $this->getInstance('00');
|
||||||
$this->assertSame($temp->toString(), '0');
|
$this->assertSame($temp->toString(), '0');
|
||||||
|
|
||||||
|
$temp = $this->getInstance('-0');
|
||||||
|
$this->assertSame($temp->toString(), '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user