From 2c8cbe6bc109f9653ea5a6d3163646e9c418b665 Mon Sep 17 00:00:00 2001 From: merbaum Date: Thu, 22 Aug 2019 13:33:27 +0200 Subject: [PATCH] bcmod cast to int for compatibility php 72 --- src/BCMathService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BCMathService.php b/src/BCMathService.php index 9e1032a..329e1ce 100644 --- a/src/BCMathService.php +++ b/src/BCMathService.php @@ -81,7 +81,7 @@ public function encode($string) $output = ''; while ($decimal >= $this->base) { $div = bcdiv($decimal, $this->base, 0); - $mod = bcmod($decimal, $this->base); + $mod = (int) bcmod($decimal, $this->base); $output .= $this->alphabet[$mod]; $decimal = $div; } @@ -146,7 +146,7 @@ public function decode($base58) // Convert from base10 to base256 (8-bit byte array) $output = ''; while ($decimal > 0) { - $byte = bcmod($decimal, 256); + $byte = (int) bcmod($decimal, 256); $output = pack('C', $byte) . $output; $decimal = bcdiv($decimal, 256, 0); }