From fcb959dec74b8c0489f48c0521299969102af3c9 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Thu, 17 Jan 2019 00:57:08 +0800 Subject: [PATCH] Fix DynamicBytes.php Call inputFormat failed when toBn return array of data See: https://github.com/sc0Vu/web3.php/pull/97 --- src/Contracts/Types/DynamicBytes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Contracts/Types/DynamicBytes.php b/src/Contracts/Types/DynamicBytes.php index aecc3e5..e6461f8 100644 --- a/src/Contracts/Types/DynamicBytes.php +++ b/src/Contracts/Types/DynamicBytes.php @@ -66,7 +66,7 @@ class DynamicBytes extends SolidityType implements IType // if (mb_strlen($value) % 2 !== 0) { // throw new InvalidArgumentException('The value to inputFormat has invalid length.'); // } - $bn = Utils::toBn(mb_strlen($value) / 2); + $bn = Utils::toBn(floor(mb_strlen($value) / 2)); $bnHex = $bn->toHex(true); $padded = mb_substr($bnHex, 0, 1); @@ -98,4 +98,4 @@ class DynamicBytes extends SolidityType implements IType return '0x' . mb_substr($value, 64, $length); } -} \ No newline at end of file +}