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

It doesn't work now, some corrections needed #26

Closed
mr-older opened this issue Apr 27, 2020 · 3 comments
Closed

It doesn't work now, some corrections needed #26

mr-older opened this issue Apr 27, 2020 · 3 comments

Comments

@mr-older
Copy link

mr-older commented Apr 27, 2020

You need to add check for nullable $tx in __construct where $this->txData = $tx.

I.e.:

if(!empty($tx))
{
$this->txData = $tx;
}

@sc0Vu
Copy link
Member

sc0Vu commented Jul 19, 2020

Since the $tx is empty array (see: https://github.com/web3p/ethereum-tx/blob/master/src/Transaction.php#L144)

and we do check whether input is hex encoded string.

I don't figure out why we should check nullable $tx in __construct.

@mr-older
Copy link
Author

If you are passing array, not hexstring, here: https://github.com/web3p/ethereum-tx/blob/master/src/Transaction.php#L176, your $tx variable doesn't exists after IFs. Your code is not working in that case at all, failing with assignment to nothing. There are numerous methods to solve it, including involving more experienced programmers, of course. Just no-testing-error :)

@sc0Vu
Copy link
Member

sc0Vu commented Sep 18, 2020

Oh, I see! I didn't set the default value of $txData.
Good finding, Thanks @mr-older !

@sc0Vu sc0Vu closed this as completed in 8d2584e Sep 21, 2020
sc0Vu added a commit that referenced this issue Sep 21, 2020
sc0Vu added a commit that referenced this issue Sep 21, 2020
Set the default value of $txData to empty array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants