diff --git a/composer.json b/composer.json index 256f18f1..e30f1524 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ }, "patches": { "drupal/jwt": { - "JwtTranscoder::$algorithmType must not be accessed before initialization (https://www.drupal.org/project/jwt/issues/3409096)": "patches/jwt-3409096.diff" + "JwtTranscoder::$algorithmType must not be accessed before initialization (https://www.drupal.org/project/jwt/issues/3409096)": "https://www.drupal.org/files/issues/2024-11-26/jwt-3409096-9-property-accessed-before-initialization.patch" } } }, diff --git a/patches/jwt-3409096.diff b/patches/jwt-3409096.diff deleted file mode 100644 index d5355577..00000000 --- a/patches/jwt-3409096.diff +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/src/Transcoder/JwtTranscoder.php b/src/Transcoder/JwtTranscoder.php -index 2cd2137ef9e5a968e0726596ca54551cbb0daecb..666e181b4ff53df277daba7f54d3523dcc2a1a08 100644 ---- a/src/Transcoder/JwtTranscoder.php -+++ b/src/Transcoder/JwtTranscoder.php -@@ -253,19 +253,22 @@ class JwtTranscoder implements JwtTranscoderInterface { - * @return null|string - * Returns NULL if opteration is not found. Otherwise, returns key. - */ -- protected function getKey(string $operation) { -- if ($this->algorithmType == 'jwt_hs') { -- return $this->secret; -- } -- elseif ($this->algorithmType == 'jwt_rs') { -- if ($operation == 'encode') { -- return $this->privateKey; -- } -- elseif ($operation == 'decode') { -- return $this->publicKey; -- } -+ protected function getKey(string $operation): ?string { -+ // Ensure $algorithmType is initialized before accessing it. -+ $algorithmType = $this->algorithmType ?? NULL; -+ -+ if ($algorithmType == 'jwt_hs') { -+ return $this->secret ?? NULL; -+ } elseif ($algorithmType == 'jwt_rs') { -+ if ($operation == 'encode') { -+ return $this->privateKey ?? NULL; -+ } elseif ($operation == 'decode') { -+ return $this->publicKey ?? NULL; -+ } - } -+ - return NULL; -- } -+} -+ - - }