From f50b8d390583e33ba54af678019284f6f2ea85a1 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Jul 2026 21:46:09 +0200 Subject: [PATCH 1/5] Bump minimum PHP-version to 8.5 --- .github/workflows/php.yml | 8 ++++---- composer.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6dc7c97..d6202fa 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.3', '8.4', '8.5'] + php-version: ['8.5'] uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1 secrets: inherit @@ -47,7 +47,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.3', '8.4', '8.5'] + php-versions: ['8.5'] steps: - name: Setup PHP, with composer and extensions @@ -109,7 +109,7 @@ jobs: fail-fast: true matrix: operating-system: [windows-latest] - php-versions: ['8.3', '8.4', '8.5'] + php-versions: ['8.5'] steps: - name: Setup PHP, with composer and extensions @@ -218,7 +218,7 @@ jobs: uses: shivammathur/setup-php@v2 with: # Should be the lowest supported version - php-version: '8.3' + php-version: '8.5' extensions: ctype, date, filter, pcre, sodium, spl tools: composer coverage: none diff --git a/composer.json b/composer.json index 7af6d4e..ffc1bcc 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ } ], "require": { - "php": "^8.3", + "php": "^8.5", "ext-date": "*", "ext-filter": "*", "ext-pcre": "*", @@ -40,7 +40,7 @@ }, "extra": { "branch-alias": { - "dev-master": "v2.1.x-dev" + "dev-master": "v3.0.x-dev" } }, "config": { From 7ed6badc8b426de5b6af26f11b9d39ceb8f0bc0e Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Jul 2026 21:57:51 +0200 Subject: [PATCH 2/5] Remove dependency on Guzzle and use PHP 8.5 builtin URI-parser --- composer.json | 2 +- src/URITrait.php | 46 ++++++++++++++++++++++++++++------------ tests/Assert/URITest.php | 4 ++-- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index ffc1bcc..3361a4d 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,8 @@ "ext-filter": "*", "ext-pcre": "*", "ext-spl": "*", + "ext-uri": "*", - "guzzlehttp/psr7": "~2.8", "webmozart/assert": "~2.1" }, "require-dev": { diff --git a/src/URITrait.php b/src/URITrait.php index 84fb2c9..383df83 100644 --- a/src/URITrait.php +++ b/src/URITrait.php @@ -4,9 +4,11 @@ namespace SimpleSAML\Assert; -use GuzzleHttp\Psr7\Exception\MalformedUriException; -use GuzzleHttp\Psr7\Uri; use InvalidArgumentException; +use Uri\InvalidUriException; +use Uri\Rfc3986\Uri; +use Uri\WhatWg\InvalidUrlException; +use Uri\WhatWg\Url; use function sprintf; use function strlen; @@ -25,7 +27,7 @@ trait URITrait * not handle any custom exception passed to it. * ***********************************************************************************/ - private static Uri $uri; + private static Uri|Url $uri; /** @@ -34,7 +36,7 @@ protected static function validURN(string $value, string $message = ''): string { try { self::$uri = new Uri($value); - } catch (MalformedUriException $e) { + } catch (InvalidUriException $e) { throw new InvalidArgumentException(sprintf( $message ?: '\'%s\' is not a valid RFC3986 compliant URI', $value, @@ -60,17 +62,17 @@ protected static function validURN(string $value, string $message = ''): string protected static function validURL(string $value, string $message = ''): string { try { - self::$uri = new Uri($value); - } catch (MalformedUriException $e) { + self::$uri = new Url($value); + } catch (InvalidUrlException $e) { throw new InvalidArgumentException(sprintf( - $message ?: '\'%s\' is not a valid RFC3986 compliant URI', + $message ?: '\'%s\' is not a valid WhatWg compliant URI', $value, )); } if (self::$uri->getScheme() !== 'http' && self::$uri->getScheme() !== 'https') { throw new InvalidArgumentException(sprintf( - $message ?: '\'%s\' is not a valid RFC2396 compliant URL', + $message ?: '\'%s\' is not a valid WhatWg compliant URL', $value, )); } @@ -83,13 +85,31 @@ protected static function validURL(string $value, string $message = ''): string */ protected static function validURI(string $value, string $message = ''): string { + $failure = false; try { self::$uri = new Uri($value); - } catch (MalformedUriException $e) { - throw new InvalidArgumentException(sprintf( - $message ?: '\'%s\' is not a valid RFC3986 compliant URI', - $value, - )); + } catch (InvalidUriException $e) { + $failure = true; + } + + if ($failure === true) { + try { + self::$uri = new Url($value); + } catch (InvalidUrlException $e) { + throw new InvalidArgumentException(sprintf( + $message ?: '\'%s\' is not a valid WhatWg compliant URL', + $value, + )); + } finally { + $failure = false; + } + + if ($failure === true) { + throw new InvalidArgumentException(sprintf( + $message ?: '\'%s\' is not a valid RFC3986 compliant URI', + $value, + )); + } } return $value; diff --git a/tests/Assert/URITest.php b/tests/Assert/URITest.php index e9317a4..a9c7f10 100644 --- a/tests/Assert/URITest.php +++ b/tests/Assert/URITest.php @@ -79,9 +79,9 @@ public static function provideURI(): array 'intl' => [true, 'https://niƱo.com'], 'spn' => [true, 'spn:a4cf592f-a64c-46ff-a788-b260f474525b'], 'typos' => [true, 'https//www.uni.l/en/'], - 'spaces' => [true, 'this is silly'], + 'spaces' => [false, 'this is silly'], 'empty' => [true, ''], - 'azure-common' => [true, 'https://sts.windows.net/{tenantid}/'], + 'azure-common' => [true, 'https://sts.windows.net/123e4567-e89b-12d3-a456-426614174000/'], 'email' => [true, 'scoobydoo@whereareyou.org'], ]; } From c88365667e10f094a95cf9411b5913b17e9b3507 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Jul 2026 22:12:30 +0200 Subject: [PATCH 3/5] Remove deprecation ReflectionMethod::setAccessible --- tests/Assert/AssertTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Assert/AssertTest.php b/tests/Assert/AssertTest.php index aebd747..7c79957 100644 --- a/tests/Assert/AssertTest.php +++ b/tests/Assert/AssertTest.php @@ -125,7 +125,6 @@ public function testValueToString(mixed $value, string $expected): void { $assert = new Assert(); $method = new ReflectionMethod(Assert::class, 'valueToString'); - $method->setAccessible(true); $this->assertEquals($expected, $method->invoke($assert, $value)); } From b606393d65df5babe45d0358c6d1696a7bdfa429 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Jul 2026 22:41:24 +0200 Subject: [PATCH 4/5] display_errors=on --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d6202fa..dd3bd2f 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -57,7 +57,7 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: ctype, date, filter, intl, pcre, sodium, spl tools: composer - ini-values: error_reporting=E_ALL + ini-values: display_errors=on, error_reporting=E_ALL coverage: pcov - name: Setup problem matchers for PHP From 032f1cec72c627523cd3611e9da33f733fa8713c Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Jul 2026 22:42:37 +0200 Subject: [PATCH 5/5] Start testing PHP 8.6-alpha --- .github/workflows/php.yml | 8 ++++---- composer.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index dd3bd2f..27d3e42 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,9 +19,9 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.5'] + php-version: ['8.5', '8.6'] - uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1 + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v2 secrets: inherit with: php-version: ${{ matrix.php-version }} @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false - uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1 + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v2 secrets: inherit with: enable_eslinter: false @@ -47,7 +47,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.5'] + php-versions: ['8.5', '8.6'] steps: - name: Setup PHP, with composer and extensions diff --git a/composer.json b/composer.json index 3361a4d..6920e3b 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "ext-intl": "*", - "simplesamlphp/simplesamlphp-test-framework": "~1.11" + "simplesamlphp/simplesamlphp-test-framework": "~2" }, "autoload": { "psr-4": {