From c4d2c6edfdde2d1e5663deb86a850a8572b12303 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Fri, 29 Dec 2017 15:31:18 +0800 Subject: [PATCH] Utils.php --- src/Utils.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Utils.php b/src/Utils.php index 6cbd1f9..e1c34fd 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -147,7 +147,9 @@ class Utils if (!is_string($value)) { throw new InvalidArgumentException('The value to isAddress function must be string.'); } - if (preg_match('/^(0x|0X)?[a-f0-9]{40}$/', $value) === 1 || preg_match('/^(0x|0X)?[A-F0-9]{40}$/', $value) === 1) { + if (preg_match('/^(0x|0X)?[a-f0-9A-F]{40}$/', $value) !== 1) { + return false; + } elseif (preg_match('/^(0x|0X)?[a-f0-9]{40}$/', $value) === 1 || preg_match('/^(0x|0X)?[A-F0-9]{40}$/', $value) === 1) { return true; } return self::isAddressChecksum($value); @@ -387,7 +389,7 @@ class Utils */ public static function toBn($number) { - if (is_int($number)) { + if (is_numeric($number)) { $bn = new BigNumber($number); } elseif (is_string($number)) { $number = mb_strtolower($number);