Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Handle apache_request_headers() non-array return values #57

Merged
merged 1 commit into from

2 participants

@arnaud-lb
Owner

apache_request_headers() can return false on failure: http://php.net/apache_request_headers

This PR handles this. (Diff best viewed with ?w=1.)

@alanbem alanbem merged commit a9e5247 into from
@alanbem
Collaborator

Thanks!

@stof stof deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/OAuth2/OAuth2.php
View
11 lib/OAuth2/OAuth2.php
@@ -589,11 +589,14 @@ protected function getBearerTokenFromHeaders(Request $request, $removeFromReques
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
- // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
- $headers = array_combine(array_map('ucwords', array_keys($headers)), array_values($headers));
+ if (is_array($headers)) {
- if (isset($headers['Authorization'])) {
- $header = $headers['Authorization'];
+ // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
+ $headers = array_combine(array_map('ucwords', array_keys($headers)), array_values($headers));
+
+ if (isset($headers['Authorization'])) {
+ $header = $headers['Authorization'];
+ }
}
}
} else {
Something went wrong with that request. Please try again.