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 PHP 8.1 deprecation error #1021

Merged
merged 1 commit into from
May 31, 2022

Conversation

snapshotpl
Copy link
Contributor

src/OAuth2/TokenType/Bearer.php Outdated Show resolved Hide resolved
@snapshotpl snapshotpl force-pushed the fix-deprecation-error branch from 8cbc0d5 to 944bdb3 Compare May 31, 2022 12:44
@snapshotpl
Copy link
Contributor Author

@bshaffer Can you look at?

Copy link
Owner

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snapshotpl this is causing the tests to fail. that is because there is a $contentType !== null check a few lines below your change which is now failing when it should succeed. The better solution would be to cast $contentType to a string when calling strpos

@@ -108,7 +108,7 @@ public function getAccessTokenParameter(RequestInterface $request, ResponseInter
return null;
}

$contentType = $request->server('CONTENT_TYPE');
$contentType = $request->server('CONTENT_TYPE', '');
if (false !== $pos = strpos($contentType, ';')) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (false !== $pos = strpos($contentType, ';')) {
if (false !== $pos = strpos((string) $contentType, ';')) {

@@ -108,7 +108,7 @@ public function getAccessTokenParameter(RequestInterface $request, ResponseInter
return null;
}

$contentType = $request->server('CONTENT_TYPE');
$contentType = $request->server('CONTENT_TYPE', '');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$contentType = $request->server('CONTENT_TYPE', '');
$contentType = $request->server('CONTENT_TYPE');

@snapshotpl snapshotpl force-pushed the fix-deprecation-error branch from 944bdb3 to b7e2bdf Compare May 31, 2022 15:35
@snapshotpl snapshotpl requested a review from bshaffer May 31, 2022 15:35
@bshaffer bshaffer merged commit 2bfaf9d into bshaffer:master May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants