Skip to content

Commit

Permalink
Fix - Deprecated PHP 8.1
Browse files Browse the repository at this point in the history
Fix for 
Deprecated
: strlen(): Passing null to parameter mautic#1 ($string) of type string is deprecated in api-library/lib/Auth/OAuth.php on 
- line 388
- line 395
- line 637
  • Loading branch information
LadySolveig authored Apr 10, 2023
1 parent ac02933 commit 3b87cc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Auth/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ public function validateAccessToken($redirect = true)
}

//Check for existing access token
if (strlen($this->_access_token) > 0) {
if ($this->_access_token && strlen($this->_access_token) > 0) {
$this->log('has access token');

return true;
}

//Reauthorize if no token was found
if (0 == strlen($this->_access_token)) {
if (!$this->_access_token || 0 == strlen($this->_access_token)) {
$this->log('access token empty so authorize');

//OAuth flows
Expand Down Expand Up @@ -634,7 +634,7 @@ protected function requestAccessToken($method = 'POST', array $params = [], $res
$parameters['code'] = $_GET['code'];
}

if (strlen($this->_refresh_token) > 0) {
if ($this->_refresh_token && strlen($this->_refresh_token) > 0) {
$this->log('Using refresh token');
$parameters['grant_type'] = 'refresh_token';
$parameters['refresh_token'] = $this->_refresh_token;
Expand Down

0 comments on commit 3b87cc8

Please sign in to comment.