1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-11-30 04:39:21 +01:00

BigInteger: fix for BigInteger('-0')

This commit is contained in:
terrafrost 2019-05-26 15:35:28 -05:00
parent 50d6c8aafd
commit 10f79a86af

View File

@ -145,7 +145,7 @@ abstract class Engine implements \Serializable
// (?<=^|-)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
$this->value = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x);
if (!strlen($this->value)) {
if (!strlen($this->value) || $this->value == '-') {
$this->value = '0';
}
static::initialize($base);