Merge pull request #320 from WizardPro/patch-1

fix: php7.4 hexdec deprecation notice. close #319
This commit is contained in:
yansongda 2020-01-11 23:00:21 +08:00 committed by GitHub
commit 7d5a919bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,7 @@
"ext-simplexml":"*",
"ext-libxml": "*",
"ext-json": "*",
"ext-bcmath": "*",
"yansongda/supports": "^2.0",
"symfony/http-foundation": "^4.0",
"symfony/event-dispatcher": "^4.0"

View File

@ -419,7 +419,9 @@ class Support
$dec = 0;
$len = strlen($hex);
for ($i = 1; $i <= $len; $i++) {
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
if (ctype_xdigit($hex[$i - 1])) {
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
}
}
return $dec;
}