web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.16k stars 543 forks source link

Use of is_numeric in Utils for formatting BigInteger's (uint256) leads to incorrect numbers #295

Open kaiesh opened 1 year ago

kaiesh commented 1 year ago

In Utils the is_numeric condition for formatting a response into a BigNumber for further manipulation does not account for numbers such as:

0x008000000000000000000000000000000e00000000000000000000000000000000

This number should be converted to:

57896044618658097711785492504343953931398945469713420508216036508001319780352

however, it is incorrectly converted to:

10633823966279326983230456482242756608

This is because e is considered a numeric character. In this context, if it is known to be a uint256 type, e should not be counted as indicative of "exponent"