From 9390307af1d2c410e1808ad89cc8fc75653940cf Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Mon, 6 Jan 2025 08:53:09 -0800 Subject: [PATCH 1/4] Address implicit nullable in fromDER --- lib/ASN1/Component/Identifier.php | 2 +- lib/ASN1/Component/Length.php | 2 +- lib/ASN1/Element.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ASN1/Component/Identifier.php b/lib/ASN1/Component/Identifier.php index 42d512f..069609f 100644 --- a/lib/ASN1/Component/Identifier.php +++ b/lib/ASN1/Component/Identifier.php @@ -85,7 +85,7 @@ public function __construct(int $class, int $pc, $tag) * * @return self */ - public static function fromDER(string $data, int &$offset = null): Identifier + public static function fromDER(string $data, ?int &$offset = null): Identifier { $idx = $offset ?? 0; $datalen = strlen($data); diff --git a/lib/ASN1/Component/Length.php b/lib/ASN1/Component/Length.php index 27216e8..5612692 100644 --- a/lib/ASN1/Component/Length.php +++ b/lib/ASN1/Component/Length.php @@ -50,7 +50,7 @@ public function __construct($length, bool $indefinite = false) * * @throws DecodeException If decoding fails */ - public static function fromDER(string $data, int &$offset = null): self + public static function fromDER(string $data, ?int &$offset = null): self { $idx = $offset ?? 0; $datalen = strlen($data); diff --git a/lib/ASN1/Element.php b/lib/ASN1/Element.php index 864fe36..38f99c8 100644 --- a/lib/ASN1/Element.php +++ b/lib/ASN1/Element.php @@ -198,7 +198,7 @@ abstract public function isConstructed(): bool; * @throws \UnexpectedValueException If called in the context of an expected * type, but decoding yields another type */ - public static function fromDER(string $data, int &$offset = null): ElementBase + public static function fromDER(string $data, ?int &$offset = null): ElementBase { $idx = $offset ?? 0; // decode identifier From 998d7b810b31d74d3c3fca404ca2d3a6ec74a5d8 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Mon, 6 Jan 2025 08:53:50 -0800 Subject: [PATCH 2/4] Also expectFromDER --- lib/ASN1/Component/Length.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ASN1/Component/Length.php b/lib/ASN1/Component/Length.php index 5612692..fb74e8c 100644 --- a/lib/ASN1/Component/Length.php +++ b/lib/ASN1/Component/Length.php @@ -98,7 +98,7 @@ public static function fromDER(string $data, ?int &$offset = null): self * @throws DecodeException If decoding or expectation fails */ public static function expectFromDER(string $data, int &$offset, - int $expected = null): self + ?int $expected = null): self { $idx = $offset; $length = self::fromDER($data, $idx); From 81badc13e71760131f7a4c0b3d7bb3042a693b9f Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Mon, 6 Jan 2025 09:03:00 -0800 Subject: [PATCH 3/4] Mark versions of PHP with GMP regression as conflicting --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 630511d..a9a26f8 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,9 @@ "require-dev": { "phpunit/phpunit": "^8.1" }, + "conflict": { + "php": "8.2.26 || 8.3.14 || 8.4.1" + }, "autoload": { "psr-4": { "Sop\\ASN1\\": "lib/ASN1/" From 74b42673635a2842dbe5d5afef40f0e9b3486f36 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Mon, 6 Jan 2025 09:03:35 -0800 Subject: [PATCH 4/4] Expand test matrix to current --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index e2bed3e..6fbd740 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ php: - "7.3" - "7.4" - "8.0" + - "8.1" + - "8.2" + - "8.3" + - "8.4" before_script: - "composer install" - "composer require php-coveralls/php-coveralls"