web-push-php icon indicating copy to clipboard operation
web-push-php copied to clipboard

Argument 1 passed to Point::create() must be an instance of BigInteger, instance of GMP given

Open nboutelier opened this issue 5 years ago • 11 comments

Ubuntu 18.04.4 LTS PHP 7.2.33-1+ubuntu18.04.1+deb.sury.org+1 web-push 6.0

Using the test code:

$subscription = Subscription::create(json_decode(file_get_contents('php://input'), true));
$auth = array(
    'VAPID' => array(
        'subject' => 'https://github.com/Minishlink/web-push-php-example/',
        'publicKey' => file_get_contents(__DIR__ . '/../keys/public_key.txt'), // don't forget that your public key also lives in app.js
        'privateKey' => file_get_contents(__DIR__ . '/../keys/private_key.txt'), // in the real world, this would be in a secret file
    ),
);
$webPush = new WebPush($auth);
$report = $webPush->sendOneNotification(
    $subscription,
    "Hello! 👋"
);

Results in this error:

PHP Fatal error:  
Uncaught TypeError: Argument 1 passed to Jose\\Component\\Core\\Util\\Ecc\\Point::create() must be an instance of Brick\\Math\\BigInteger, 
instance of GMP given, called in 
WebPush/vendor/minishlink/web-push/src/Encryption.php on line 290 and defined in 
WebPush/vendor/web-token/jwt-util-ecc/Point.php:75\nStack trace:\n#0 
WebPush/vendor/minishlink/web-push/src/Encryption.php(290): Jose\\Component\\Core\\Util\\Ecc\\Point::create(Object(GMP), Object(GMP))\n#1 
WebPush/vendor/minishlink/web-push/src/Encryption.php(246): Minishlink\\WebPush\\Encryption::createLocalKeyObjectUsingOpenSSL()\n#2 
WebPush/vendor/minishlink/web-push/src/Encryption.php(64): Minishlink\\WebPush\\Encryption::createLocalKeyObject()\n#3 
WebPush/vendor/minishlink/web-push/src/WebPush.php(225): Minishlink\\WebPush\\Encryption::encrypt('\\v\\xE7\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00...', 'BLkQ in 
WebPush/vendor/web-token/jwt-util-ecc/Point.php on line 75

nboutelier avatar Sep 01 '20 00:09 nboutelier

See #289

Spomky avatar Sep 01 '20 04:09 Spomky

See #289

Unfortunately still produces the same error.

nboutelier avatar Sep 01 '20 23:09 nboutelier

Installing web-token/jwt-util-ecc version 2.1.9 solves the issue while this library gets updated

javiermarinros avatar Sep 03 '20 08:09 javiermarinros

Installing web-token/jwt-util-ecc version 2.1.9 solves the issue while this library gets updated

Thanks, @javiermarinros that's worked for me.

"require": {
    "minishlink/web-push": "^6.0.0",
    "web-token/jwt-util-ecc": "2.1.9"
}

tox777 avatar Sep 05 '20 12:09 tox777

Can you try on v6.0.1 please?

Minishlink avatar Sep 13 '20 05:09 Minishlink

v6.0.1 is still failing for me:

TypeError: Argument 1 passed to Jose\Component\Core\Util\Ecc\Point::create() must be an instance of Brick\Math\BigInteger, instance of GMP given, called in /workspace/vendor/minishlink/web-push/src/Encryption.php on line 290

javiermarinros avatar Sep 13 '20 11:09 javiermarinros

@javiermarinros I am not sure you are using v6.0.1 There is no call to Point::create at line 290. Looks like you are still using 6.0.0

Spomky avatar Sep 13 '20 11:09 Spomky

You're right, I was still on v6.0.0 😅

Using v6.0.1 solved the issue for me. Thank you!

javiermarinros avatar Sep 14 '20 13:09 javiermarinros

Getting the same with 6.0.2 Any idea ?

guestisp avatar Oct 19 '20 11:10 guestisp

6.0.7 and I'm still facing this TypeError: Jose\Component\Core\Util\Ecc\PrivateKey::create(): Argument #1 ($secret) must be of type Brick\Math\BigInteger, GMP given, called in /var/www/Minds/engine/vendor/minishlink/web-push/src/Encryption.php on line 392 and defined in /var/www/Minds/engine/vendor/web-token/jwt-util-ecc/PrivateKey.php:57

manishoo avatar Mar 22 '22 12:03 manishoo

Still having this error (PHP 8.0) with minishlink/web-push 7.0.0: Fatal error: Uncaught TypeError: Jose\Component\Core\Util\Ecc\PrivateKey::create(): Argument #1 ($secret) must be of type Brick\Math\BigInteger, GMP given, called in [...]/vendor/minishlink/web-push/src/Encryption.php on line 355 and defined in [...]/vendor/web-token/jwt-util-ecc/PrivateKey.php:57

strarsis avatar May 24 '23 01:05 strarsis