Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Critical issue with bcmath #237

Closed
quantumwebco opened this issue Jun 17, 2017 · 12 comments
Closed

Critical issue with bcmath #237

quantumwebco opened this issue Jun 17, 2017 · 12 comments

Comments

@quantumwebco
Copy link

quantumwebco commented Jun 17, 2017

Why??

try {
	/**
	 * Now create our invoice...
	 */
	$client->createInvoice($invoice);


} catch (Exception $e) {
	echo $e->getMessage();
	exit;
}

So I edited client.php to actually output an error from the request instead of just the generic one from the exception.

It says invalid signature.

This code/token/keys works on every other server but on an Azure server it isn't playing along.

Maybe something to do with the Request?

Any ideas?

@quantumwebco quantumwebco changed the title Error with request MS Azure - Error with request - invalid signature Jun 21, 2017
@pieterpoorthuis
Copy link

I presume you're running the script in a web server. Do you have mcrypt enabled in your PHP? And either bcmath or gmp? You can easily check using phpinfo()

@quantumwebco
Copy link
Author

quantumwebco commented Jun 23, 2017

System Windows NT RD0003FFA23CC4 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586
PHP-5.6.30

mcrypt support enabled
mcrypt_filter support enabled
Version 2.5.8
Api No 20021217
Supported ciphers cast-128 gost rijndael-128 twofish cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes arcfour
Supported modes cbc cfb ctr ecb ncfb nofb ofb stream

bcmath

BCMath support enabled
Directive Local Value Master Value
bcmath.scale 0 0

GNU GMP support Stanislav Malyshev

@quantumwebco
Copy link
Author

There is a critical issue with php 5.6.3 and bcmath.

The signature does not sign correctly using php 5.6.3 and bcmath.

Do you have a solution for this please??

@quantumwebco quantumwebco changed the title MS Azure - Error with request - invalid signature Critical issue with PHP 5.6.3 and bcmath Jun 24, 2017
@quantumwebco
Copy link
Author

Same issue with PHP 7.1.x and bcmath on MS Azure App Service

@quantumwebco quantumwebco changed the title Critical issue with PHP 5.6.3 and bcmath Critical issue with bcmath Jun 24, 2017
@quantumwebco
Copy link
Author

Same issue with bcmath on all servers.

Bcmath does not work with this library.

@pieterpoorthuis
Copy link

I'm testing on Mac OS, both with PHP 5.6.30 and PHP7.1.6, but unable to replicate the bcmath issue.
I've saved & loaded private keys using both gmp & bcmath, in different orders. The signatures that are created are always valid for me.

Which version of BitPay's PHP library are you using? Are you using a password to encrypt your private key when storing it? Did you create the private key file with a previous version of the PHP library?

@pieterpoorthuis
Copy link

Can you show your bcmath configuration, e.g. using:

MacBook-Air$ php --ri bcmath
bcmath
BCMath support => enabled
Directive => Local Value => Master Value
bcmath.scale => 0 => 0

@pieterpoorthuis
Copy link

Just saw your bcmath config in your initial post.

Still trying to replicate the issue (with no success yet)

@quantumwebco
Copy link
Author

quantumwebco commented Jun 28, 2017

Yes. Please do try and read properly. I do try and add all relevant information to my questions and posts.

I have now installed and activated GMP on this MS azure windows server and it has solved the problem.

Therefore I have never been able to get this library to work with bcmath on any server but with GMP it works fine on all servers I have tested.

It all connects with the merchant token not generating properly and only returning half the characters but this issue has never even been acknowledged by you or Andy. #236

There is some critical issue with bcmath, other people have reported it too. I don't know how you can recreate it. Did you try turning off GMP?? Or setting up a windows server with only bcmath enabled?? It also happened on my windows/apache server too with bcmath too so It seems like its bcmath related and the library isn't working properly with bcmath on windows.

@quantumwebco
Copy link
Author

You are trying to replicate on a mac. The error occurs in windows.

@pieterpoorthuis
Copy link

I just tried on Windows 10 (PHP 5.6.30) and Ubuntu, everything works correctly for me when using bcmath. So I still can't replicate and thus can't find the root cause.

If bcmath keeps being an issue for certain users, we'll deploy the next version with gmp only support (disabling bcmath support).

@estebandelaf
Copy link

Not working with bcmath in Debian/GNU Linux stretch with PHP 7.0.19-1.

I removed bcmath and I installed only gmp and it works.

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

No branches or pull requests

3 participants