From 6a9244603695e69074510b1893a9b85e54e1e818 Mon Sep 17 00:00:00 2001 From: Sander Kondratjev Date: Mon, 11 May 2026 14:36:06 +0300 Subject: [PATCH] =?UTF-8?q?NFC-162=20Fix=20PHP=20example=20JSON=20response?= =?UTF-8?q?s=20and=20restore=20PHP=208.1=E2=80=938.3=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sander Kondratjev --- example/composer.json | 2 +- example/public/index.php | 4 +++- example/src/Auth.php | 2 +- example/src/AuthContext.php | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/example/composer.json b/example/composer.json index 71148f7..9a15bfd 100644 --- a/example/composer.json +++ b/example/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "php": ">=8.5", + "php": ">=8.1", "web-eid/web-eid-authtoken-validation-php": "1.3.*", "altorouter/altorouter": "^2.0.3", "psr/log": "^3.0" diff --git a/example/public/index.php b/example/public/index.php index 094c1c1..b8494a8 100644 --- a/example/public/index.php +++ b/example/public/index.php @@ -24,12 +24,14 @@ header('Content-type: text/html; charset=UTF-8'); +ini_set('display_errors', '0'); + session_start(); // Uncomment following line to define the custom log location (by default the server log is used) //define("LOGFILE", dirname(__FILE__) . "/../log/web-eid-authtoken-validation-php.log"); -require __DIR__ . '/../vendor/autoload.php'; +require_once __DIR__ . '/../vendor/autoload.php'; $configArr = require_once __DIR__ . '/../src/app.conf.php'; $config = Config::fromArray($configArr)->overrideFromEnv(); diff --git a/example/src/Auth.php b/example/src/Auth.php index 3c8d4c8..293eb0d 100644 --- a/example/src/Auth.php +++ b/example/src/Auth.php @@ -73,7 +73,7 @@ public function validate() try { /* Get and remove nonce from store */ - $challengeNonce = new ChallengeNonceStore()->getAndRemove(); + $challengeNonce = (new ChallengeNonceStore())->getAndRemove(); $authResult = $this->ctx->authenticate( $authToken, diff --git a/example/src/AuthContext.php b/example/src/AuthContext.php index 34788ca..849b119 100644 --- a/example/src/AuthContext.php +++ b/example/src/AuthContext.php @@ -136,14 +136,14 @@ public function trustedIntermediateCACertificates(): array public function nonceGenerator(): ChallengeNonceGenerator { - return new ChallengeNonceGeneratorBuilder()->withNonceTtl(300)->build(); + return (new ChallengeNonceGeneratorBuilder())->withNonceTtl(300)->build(); } public function tokenValidator(): AuthTokenValidator { $logger = new Logger(); - return new AuthTokenValidatorBuilder($logger) + return (new AuthTokenValidatorBuilder($logger)) ->withSiteOrigin(new Uri($this->config->get("origin_url"))) ->withTrustedCertificateAuthorities( ...$this->trustedIntermediateCACertificates(),