-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Remove bcmath dependency #694
Comments
Please see #573. If that is a reasonable option, please fix the issues I found with that pull request, or open a new one to address your request here. Remember that this library is maintained by volunteers, so contributing code (with tests) is the best way to help. |
@lukebakken - see #695. I'm not sure that #573 is really all that applicable. It looks like that is attempting to replace bcmath with floats. This just updates php-amqplib to use a bcmath polyfill. Other famous polyfill's are ircmaxell/password-compat, paragonie/random_compat, paragonie/sodium_compat, ramsey/array_column, etc. Symfony has a whole collection of polyfill's, as well, for such things as mbstring, etc. They're supposed to be just drop in replacements for missing extensions or out-of-date PHP versions. One thing that would be cool is Travis CI could run two versions of each PHP VM - one with bcmath and one without. But alas I do not know how to set it up to do that. I posted about this at https://stackoverflow.com/q/56318348/569976 in an attempt to figure out how this might be done. |
@terrafrost Regarding travis, You can disable extension before tests and then run tests 2 times, with and without extension. |
Moved to |
Fixed by #754 |
See https://github.com/phpseclib/bcmath_compat .
It basically turns phpseclib's BigInteger class into a BigDecimal class.
Surprisingly, the shim is actually faster than the original bcmath extension for certain operations. Using https://pastebin.com/x8wJBK4F (which, admittedly, is running off of phpseclib/phpseclib:dev-master - not off of the 2.0 branch) I get the following results:
The fact that phpseclib is able to do modular exponentiation with bcmath faster than bcmath, itself, can is due to the fact that phpseclib (dev-master) uses barrett modular reduction whereas bcmath doesn't. And those results are without OpenSSL, which is used, as well, if it's available, for even faster modular exponentiation.
The text was updated successfully, but these errors were encountered: