Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for PHP <7.4 compatibility #1183

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Command/EnableEncryptionConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$algorithms = $this->algorithmManagerFactory->all();
$availableKeyEncryptionAlgorithms = array_map(
static fn (Algorithm $algorithm): string => $algorithm->name(),
array_filter($algorithms, static fn (Algorithm $algorithm): bool => ($algorithm instanceof KeyEncryptionAlgorithm && $algorithm->name() !== 'dir'))
static function (Algorithm $algorithm): string {
return $algorithm->name();
},
array_filter($algorithms, static function (Algorithm $algorithm): bool {
return ($algorithm instanceof KeyEncryptionAlgorithm && $algorithm->name() !== 'dir');
})
);
$availableContentEncryptionAlgorithms = array_map(
static fn (Algorithm $algorithm): string => $algorithm->name(),
array_filter($algorithms, static fn (Algorithm $algorithm): bool => $algorithm instanceof ContentEncryptionAlgorithm)
static function (Algorithm $algorithm): string {
return $algorithm->name();
},
array_filter($algorithms, static function (Algorithm $algorithm): bool {
return $algorithm instanceof ContentEncryptionAlgorithm;
})
);

$keyEncryptionAlgorithmAlias = $io->choice('Key Encryption Algorithm', $availableKeyEncryptionAlgorithms);
Expand Down Expand Up @@ -215,7 +223,7 @@ private function checkRequirements(): void
JWEBuilder::class => 'web-token/jwt-encryption',
];
if ($this->algorithmManagerFactory === null) {
throw new \RuntimeException(sprintf('The package "web-token/jwt-bundle" is missing. Please install it for using this migration tool.', $requirement));
throw new \RuntimeException('The package "web-token/jwt-bundle" is missing. Please install it for using this migration tool.');
}
foreach (array_keys($requirements) as $requirement) {
if (!class_exists($requirement)) {
Expand Down
2 changes: 1 addition & 1 deletion Security/Http/Cookie/JWTCookieProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function createCookie(string $jwt, ?string $name = null, $expiresAt = nul
$httpOnly ?: $this->defaultHttpOnly,
false,
$sameSite ?: $this->defaultSameSite,
$partitioned ?: $this->defaultPartitioned,
$partitioned ?: $this->defaultPartitioned
);
}
}
Loading