Closed JeyjooMilano closed 6 months ago
I know this is an old issue, but as I came across it as well I thought I'd reply with the resolution in case someone else has the problem.
The error above is caused when using the most up to date version of web-token/jwt-key-mgmt on PHP 7. The most up to date version is only compatible with PHP 8. Therefore to resolve the problem I downgraded to a lower version of web-token/jwt-key-mgmt which works with PHP 7 and now everything is working perfectly.
Setup
following enables: gmp, mbstring, curl, openssl
Problem
I want to generate a VAPID key set using the web-push-php package.
I get the error: Parse error: syntax error, unexpected '|', expecting ';' or '{' in .../push/vendor/web-token/jwt-key-mgmt/JWKFactory.php on line 156
Expected
Expected to return VAPID key
Features Used
VAPID Support
Example / Reproduce Case
Here is my code:
require_once '../push/vendor/autoload.php'; use Minishlink\WebPush\VAPID; $keyset = VAPID::createVapidKeys(); echo $keyset["publicKey"]; file_put_contents("vapid.json", json_encode($keyset));
Other
It is not liking the |. Line 156 is: public static function createFromJsonObject(string $value): JWK|JWKSet
Any ideas? Thanks