Skip to content

Commit

Permalink
fix: http_build_query(): Passing null to parameter #2 ($numeric_prefi…
Browse files Browse the repository at this point in the history
…x) of type string is deprecated
  • Loading branch information
piuma committed Nov 8, 2023
1 parent 15c2510 commit b493b44
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ public function authenticate() {
throw new OpenIDConnectClientException('Got response: ' . $token_json->error);
}

// Sometime getState() return an empty string
// Sometime getState() return an empty string
// and the authentication process fail
if ($this->getState() == "")
$this->setState($_REQUEST['state']);

// Do an OpenID Connect session check
if ($_REQUEST['state'] !== $this->getState()) {
throw new OpenIDConnectClientException('Unable to determine state');
Expand Down Expand Up @@ -350,7 +350,7 @@ public function authenticate() {
$this->setNonce($claims->nonce);
user_error('Warning: Function getNonce return empty, setting in the session!');
};

// If this is a valid claim
if ($this->verifyJWTclaims($claims, $token_json->access_token)) {

Expand Down Expand Up @@ -467,7 +467,7 @@ public function signOut($enduserIdentification, $redirect, $method = "id_token_h
'post_logout_redirect_uri' => $redirect);
}

$signout_endpoint .= (strpos($signout_endpoint, '?') === false ? '?' : '&') . http_build_query( $signout_params, null, '&', $this->enc_type);
$signout_endpoint .= (strpos($signout_endpoint, '?') === false ? '?' : '&') . http_build_query( $signout_params, '', '&', $this->enc_type);
$this->redirect($signout_endpoint);
}

Expand Down Expand Up @@ -692,7 +692,7 @@ private function requestAuthorization() {
));
}

$auth_endpoint .= (strpos($auth_endpoint, '?') === false ? '?' : '&') . http_build_query($auth_params, null, '&', $this->enc_type);
$auth_endpoint .= (strpos($auth_endpoint, '?') === false ? '?' : '&') . http_build_query($auth_params, '', '&', $this->enc_type);

$this->commitSession();
$this->redirect($auth_endpoint);
Expand All @@ -718,7 +718,7 @@ public function requestClientCredentialsToken() {
);

// Convert token params to string format
$post_params = http_build_query($post_data, null, '&', $this->enc_type);
$post_params = http_build_query($post_data, '', '&', $this->enc_type);

return json_decode($this->fetchURL($token_endpoint, $post_params, $headers));
}
Expand Down Expand Up @@ -753,7 +753,7 @@ public function requestResourceOwnerToken($bClientAuth = FALSE) {
}

// Convert token params to string format
$post_params = http_build_query($post_data, null, '&', $this->enc_type);
$post_params = http_build_query($post_data, '', '&', $this->enc_type);

return json_decode($this->fetchURL($token_endpoint, $post_params, $headers));
}
Expand Down Expand Up @@ -799,7 +799,7 @@ protected function requestTokens($code) {
}

// Convert token params to string format
$token_params = http_build_query($token_params, null, '&', $this->enc_type);
$token_params = http_build_query($token_params, '', '&', $this->enc_type);

$this->tokenResponse = json_decode($this->fetchURL($token_endpoint, $token_params, $headers));

Expand All @@ -826,7 +826,7 @@ public function refreshToken($refresh_token) {
);

// Convert token params to string format
$token_params = http_build_query($token_params, null, '&', $this->enc_type);
$token_params = http_build_query($token_params, '', '&', $this->enc_type);

$json = json_decode($this->fetchURL($token_endpoint, $token_params));

Expand Down Expand Up @@ -1441,7 +1441,7 @@ public function introspectToken($token, $token_type_hint = '', $clientId = null,
$clientSecret = $clientSecret !== null ? $clientSecret : $this->clientSecret;

// Convert token params to string format
$post_params = http_build_query($post_data, null, '&');
$post_params = http_build_query($post_data, '', '&');
$headers = ['Authorization: Basic ' . base64_encode(urlencode($clientId) . ':' . urlencode($clientSecret)),
'Accept: application/json'];

Expand Down Expand Up @@ -1472,7 +1472,7 @@ public function revokeToken($token, $token_type_hint = '', $clientId = null, $cl
$clientSecret = $clientSecret !== null ? $clientSecret : $this->clientSecret;

// Convert token params to string format
$post_params = http_build_query($post_data, null, '&');
$post_params = http_build_query($post_data, '', '&');
$headers = ['Authorization: Basic ' . base64_encode(urlencode($clientId) . ':' . urlencode($clientSecret)),
'Accept: application/json'];

Expand Down

0 comments on commit b493b44

Please sign in to comment.