Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit c5b0dab

Browse files
committed
#8 revert short list syntax
The short list-syntax breaks the test when getHeader() returns only one element but with a non-zero index.
1 parent 10c3f6d commit c5b0dab

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/BasicAccess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function authenticate(ServerRequestInterface $request) : ?UserInterface
5858
return null;
5959
}
6060

61-
[$authHeader] = $authHeaders;
61+
$authHeader = array_shift($authHeaders);
6262

6363
if (! preg_match('/Basic (?P<credentials>.+)/', $authHeader, $match)) {
6464
return null;

test/BasicAccessTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ public function provideValidAuthentication(): array
176176
{
177177
return [
178178
'aladdin' => ['Aladdin', 'OpenSesame', ['Basic ' . base64_encode('Aladdin:OpenSesame')]],
179+
'aladdin-with-nonzero-array-index' => [
180+
'Aladdin',
181+
'OpenSesame',
182+
[
183+
-200 => 'Basic ' . base64_encode('Aladdin:OpenSesame')
184+
]
185+
],
179186
'passwords-with-colon' => ['Aladdin', 'Open:Sesame', ['Basic ' . base64_encode('Aladdin:Open:Sesame')]],
180187
'username-without-password' => ['Aladdin', '', ['Basic ' . base64_encode('Aladdin:')]],
181188
'password-without-username' => ['', 'OpenSesame', ['Basic ' . base64_encode(':OpenSesame')]],

0 commit comments

Comments
 (0)