bitcoin-lib-php icon indicating copy to clipboard operation
bitcoin-lib-php copied to clipboard

Unnecessary cast in toBTC()

Open hlynx opened this issue 7 years ago • 0 comments

/src/BitcoinLib.php [1011]

public static function toBTC($satoshi)
{
    return bcdiv((int)(string)$satoshi, 100000000, 8);
}

Looks like it will silently fail on type overflow with 32-bit integer. bcdiv works with strings. So omiting that cast looks apropriate:

bcdiv((string)$satoshi, 100000000, 8);

hlynx avatar Sep 05 '17 15:09 hlynx