mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-28 01:28:27 +00:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
77ffe153a0
@ -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*: 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)) {
|
||||||
|
$x = '0';
|
||||||
|
}
|
||||||
|
|
||||||
switch (MATH_BIGINTEGER_MODE) {
|
switch (MATH_BIGINTEGER_MODE) {
|
||||||
case self::MODE_GMP:
|
case self::MODE_GMP:
|
||||||
|
@ -403,4 +403,10 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
|||||||
$temp = $this->getInstance(48);
|
$temp = $this->getInstance(48);
|
||||||
$this->assertSame($temp->toHex(true), '30');
|
$this->assertSame($temp->toHex(true), '30');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testZeroBase10()
|
||||||
|
{
|
||||||
|
$temp = $this->getInstance('00');
|
||||||
|
$this->assertSame($temp->toString(), '0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user