web-push-php
web-push-php copied to clipboard
Argument 1 passed to Point::create() must be an instance of BigInteger, instance of GMP given
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
See #289
See #289
Unfortunately still produces the same error.
Installing web-token/jwt-util-ecc version 2.1.9 solves the issue while this library gets updated
Installing
web-token/jwt-util-eccversion2.1.9solves 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"
}
Can you try on v6.0.1 please?
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 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
You're right, I was still on v6.0.0 😅
Using v6.0.1 solved the issue for me. Thank you!
Getting the same with 6.0.2 Any idea ?
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
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