Skip to content

Commit

Permalink
[HttpFoundation] Basic auth in url is broken when using PHP CGI/FPM
Browse files Browse the repository at this point in the history
Request#getUser() and Request#getPassword() introduced in
aecfd0a do not handle the lack of
PHP_AUTH_USER and PHP_AUTH_PW in $this->server when using PHP-FPM. Use
$this->headers instead.
Furthermore, the test of empty password now expects an empty string
instead of NULL according to a450d00.
  • Loading branch information
Kdecherf committed Jun 10, 2014
1 parent 6bd8027 commit 7a75adf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpFoundation/Request.php
Expand Up @@ -949,7 +949,7 @@ public function getPort()
*/
public function getUser()
{
return $this->server->get('PHP_AUTH_USER');
return $this->headers->get('PHP_AUTH_USER');
}

/**
Expand All @@ -959,7 +959,7 @@ public function getUser()
*/
public function getPassword()
{
return $this->server->get('PHP_AUTH_PW');
return $this->headers->get('PHP_AUTH_PW');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Expand Up @@ -209,7 +209,7 @@ public function testCreate()
$this->assertEquals(80, $request->getPort());
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertEquals('testnopass', $request->getUser());
$this->assertNull($request->getPassword());
$this->assertSame('',$request->getPassword());
$this->assertFalse($request->isSecure());

$request = Request::create('http://test.com/?foo');
Expand Down

0 comments on commit 7a75adf

Please sign in to comment.