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

Illegal string offset exception in BCMathService.php #17

Closed
waylaidwanderer opened this issue Jul 19, 2016 · 5 comments
Closed

Illegal string offset exception in BCMathService.php #17

waylaidwanderer opened this issue Jul 19, 2016 · 5 comments
Assignees
Labels

Comments

@waylaidwanderer
Copy link

Here's the error:

image

On line 91: $output .= $this->alphabet[$decimal];

Since $decimal is a float, the above line won't work.

@waylaidwanderer
Copy link
Author

waylaidwanderer commented Jul 19, 2016

Edit: I see this issue has been posted already. My bad.

@stephen-hill
Copy link
Owner

Hi Joel

This library does encode strings. I have seen this issue before, but have never been able to replicate it myself. I get the following when testing the string you are trying to encode:

$b = new StephenHill\Base58();                          
$b->encode('0248ac9d3652ccd8350412b83cb08509e7e4bd41'); 
// Encodes to "3PtvAWwSMPe2DohNuCFYy76JhMV3rhxiSxQMbPBTtiPvYvneWu95XaY"
$b->decode('3PtvAWwSMPe2DohNuCFYy76JhMV3rhxiSxQMbPBTtiPvYvneWu95XaY');
// Decodes to "0248ac9d3652ccd8350412b83cb08509e7e4bd41"

What version of PHP are you using? What processor are you using?

Cheers
Stephen

@stephen-hill stephen-hill reopened this Jul 19, 2016
@stephen-hill stephen-hill self-assigned this Jul 19, 2016
@waylaidwanderer
Copy link
Author

It fails with PHP 5.5.11 on Apache (bundled with XAMPP), but works fine on PHP 5.6.10 on the CLI.

Switching from BCMath to GMP on Apache's PHP seems to fix the issue though.

@stephen-hill
Copy link
Owner

I believe I've found the problem with the BCMath service. I'll write some unit tests tonight and hopefully provide a v1.1.4 patch.

stephen-hill added a commit that referenced this issue Jul 20, 2016
@stephen-hill
Copy link
Owner

I believe I have fixed this in release v1.1.4.

I would be grateful if you could update to the latest version and let me know if it fixes your original error.

Many Thanks
Stephen

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

No branches or pull requests

2 participants