Closed waylaidwanderer closed 8 years ago
Edit: I see this issue has been posted already. My bad.
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
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.
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.
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
Here's the error:
On line 91:
$output .= $this->alphabet[$decimal];
Since
$decimal
is a float, the above line won't work.