Skip to content
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

PHP Fatal error: Uncaught TypeError: Jose\Component\Core\Util\Ecc\PrivateKey::create(): #338 #352

Closed
6 tasks done
alpastar opened this issue Apr 14, 2022 · 1 comment
Closed
6 tasks done

Comments

@alpastar
Copy link

alpastar commented Apr 14, 2022

same error with #338

Setup

UBUNTU 20.04 LTS
PHP-FPM 7.4.3
web-push-php Version: 7.0.0
Chrome-100

  • gmp
  • mbstring
  • curl
  • openssl

Features Used

  • VAPID Support
  • Sending with Payload

code

use Minishlink\WebPush\WebPush;
use Minishlink\WebPush\Subscription;
require_once "vendor/autoload.php";

$sub = Subscription::create(
[ "endpoint" => 'https://fcm.googleapis.com/fcm/send/fAPQ61 ------- uf',
"keys" => [
'p256dh'=>'BD --------------------- Tw' ,
'auth' => 'f --------- w'
] ,
]) ;

$payload = '{"msg":"Hello World!"}' ;

$webPush = new WebPush();
$report = $webPush->sendOneNotification($sub , $payload);

result -error

2022/04/13 22:39:46 [error] 368579#368579: *717 FastCGI sent in stderr:
"PHP message: PHP Fatal error: Uncaught TypeError:
Argument 1 passed to Jose\Component\Core\Util\Ecc\PrivateKey::create()
must be an instance of Brick\Math\BigInteger,
instance of GMP given,
called in /var/www/public/push/vendor/minishlink/web-push/src/Encryption.php on line 355
and defined in /var/www/public/push/vendor/web-token/jwt-util-ecc/PrivateKey.php:57

Stack trace:
#0 /var/www/public/push/vendor/minishlink/web-push/src/Encryption.php(355): Jose\Component\Core\Util\Ecc\PrivateKey::create()
#1 /var/www/public/push/vendor/minishlink/web-push/src/Encryption.php(105): Minishlink\WebPush\Encryption::calculateAgreementKey()
#2 /var/www/public/push/vendor/minishlink/web-push/src/Encryption.php(61): Minishlink\WebPush\Encryption::deterministicEncrypt()
#3 /var/www/public/push/vendor/minishlink/web-push/src/WebPush.php(224): Minishlink\WebPush\Encryption::encrypt()
#4 /var/www/public/push/vendor/minishlink/web-push/src/WebPush.php(171): Minishlink\WebPush\WebPush->prepare()

@Oxmoze
Copy link

Oxmoze commented Apr 15, 2022

If you expect answer here... this library seems abandoned. It is not working at all...
I find this one: https://github.com/spomky-labs/web-push better design, better documentation and work as expected with chrome, edge and firefox.
And a demo to test it: https://quiet-caverns-28842.herokuapp.com/

Dead simple

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

No branches or pull requests

3 participants