Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contract->call problem when returning multiple parameters #70

Open
jackneil opened this issue Apr 17, 2018 · 1 comment
Open

contract->call problem when returning multiple parameters #70

jackneil opened this issue Apr 17, 2018 · 1 comment

Comments

@jackneil
Copy link

jackneil commented Apr 17, 2018

when using:
$contract->call("getRecord", 12345, function($err, $data) {
print_r($data);
}

the getRecord method in the contract returns 4 elements (address, string, string, uint256)

the $data returned is ONLY the uint256 (as an array). It looks like the decodeParameters function in Ethabi called from Contract.php is only returning the last element instead of returning an array of all elements. Any idea on how to get to all 4 returned elements? It works as expected in javascript web3 class. Thanks!
-jack

@jackneil
Copy link
Author

OK. looks like the problem is it was considering the 'name' in the abi as being set even though it was empty. thus, each decodeParameters iteration through the paramaters was overwriting the previous object. might want to look at the way it is determines if the 'name' is set in the outputs parameters inside the Ethabi.php file in the decodeParameters function. maybe instead of just checking if isset($outputTypes['outputs'][$i]['name']) you should also check that it isn't == ""

thanks for the amazing work on this project though! excellent work!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants