Skip to content

Commit

Permalink
fix(php8): resolve deprecation warning for urlencode() in PHP 8+
Browse files Browse the repository at this point in the history
  • Loading branch information
alan199501 committed Sep 23, 2024
1 parent 97adbce commit a682f2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.2] - 2024-09-20

### Fixed

- Fixed a deprecation warning in PHP 8+ for `urlencode()`. The `client_id` and `client_secret` parameters in the constructor of `OpenIDConnectClient` were updated to default to an empty string (`''`) instead of `null`. This resolves issues where passing `null` to `urlencode()` would trigger a deprecation warning in PHP 8+.

## [1.0.1] - 2024-09-13

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,8 @@ protected function requestTokens(string $code, array $headers = []) {
$authorizationHeader = null;
# Consider Basic authentication if provider config is set this way
if ($this->supportsAuthMethod('client_secret_basic', $token_endpoint_auth_methods_supported)) {
$this->clientID = $this->clientID ?? '';
$this->clientSecret = $this->clientSecret ?? '';
$authorizationHeader = 'Authorization: Basic ' . base64_encode(urlencode($this->clientID) . ':' . urlencode($this->clientSecret));
unset($token_params['client_secret'], $token_params['client_id']);
}
Expand Down

0 comments on commit a682f2c

Please sign in to comment.