Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit b1d5c35

Browse files
Merge branch '2.5' into 2.6
* 2.5: [2.3] Remove useless tests skips [ClassLoader] removes deprecated classes from documentation. [ClassLoader] added missing deprecation notice. [HttpFoundation] Fix an issue caused by php's Bug #66606. [Yaml] Update README.md Don't add Accept-Range header on unsafe HTTP requests simplify hasScheme method adapted merge to 2.5 adapted previous commit for 2.3 [Security] Don't send remember cookie for sub request [Security] fixed wrong phpdoc [HttpKernel] Fix UriSigner::check when _hash is not at the end of the uri [2.3] Cleanup deprecations Conflicts: src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig src/Symfony/Component/HttpKernel/composer.json
2 parents 6c39103 + 3c08afb commit b1d5c35

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

Core/Authentication/Token/TokenInterface.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ public function getCredentials();
4747
/**
4848
* Returns a user representation.
4949
*
50-
* @return mixed either returns an object which implements __toString(), or
51-
* a primitive string is returned.
50+
* @return mixed Can be a UserInterface instance, an object implementing a __toString method,
51+
* or the username as a regular string
52+
*
53+
* @see AbstractToken::setUser()
5254
*/
5355
public function getUser();
5456

Http/RememberMe/ResponseListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class ResponseListener implements EventSubscriberInterface
2727
*/
2828
public function onKernelResponse(FilterResponseEvent $event)
2929
{
30+
if (!$event->isMasterRequest()) {
31+
return;
32+
}
33+
3034
$request = $event->getRequest();
3135
$response = $event->getResponse();
3236

Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ public function testHandleWithContextHavingNoToken()
7373

7474
public function testHandledEventIsLogged()
7575
{
76-
if (!interface_exists('Psr\Log\LoggerInterface')) {
77-
$this->markTestSkipped('The "LoggerInterface" is not available');
78-
}
79-
8076
$context = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');
8177
$logger = $this->getMock('Psr\Log\LoggerInterface');
8278
$logger->expects($this->once())

Http/Tests/RememberMe/ResponseListenerTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests\RememberMe;
1313

14+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1415
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
1516
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
1617
use Symfony\Component\HttpFoundation\Request;
@@ -34,6 +35,21 @@ public function testRememberMeCookieIsSentWithResponse()
3435
$listener->onKernelResponse($this->getEvent($request, $response));
3536
}
3637

38+
public function testRememberMeCookieIsNotSendWithResponseForSubRequests()
39+
{
40+
$cookie = new Cookie('rememberme');
41+
42+
$request = $this->getRequest(array(
43+
RememberMeServicesInterface::COOKIE_ATTR_NAME => $cookie,
44+
));
45+
46+
$response = $this->getResponse();
47+
$response->headers->expects($this->never())->method('setCookie');
48+
49+
$listener = new ResponseListener();
50+
$listener->onKernelResponse($this->getEvent($request, $response, HttpKernelInterface::SUB_REQUEST));
51+
}
52+
3753
public function testRememberMeCookieIsNotSendWithResponse()
3854
{
3955
$request = $this->getRequest();
@@ -71,13 +87,14 @@ private function getResponse()
7187
return $response;
7288
}
7389

74-
private function getEvent($request, $response)
90+
private function getEvent($request, $response, $type = HttpKernelInterface::MASTER_REQUEST)
7591
{
7692
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FilterResponseEvent')
7793
->disableOriginalConstructor()
7894
->getMock();
7995

8096
$event->expects($this->any())->method('getRequest')->will($this->returnValue($request));
97+
$event->expects($this->any())->method('isMasterRequest')->will($this->returnValue($type === HttpKernelInterface::MASTER_REQUEST));
8198
$event->expects($this->any())->method('getResponse')->will($this->returnValue($response));
8299

83100
return $event;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"symfony/security-http": "self.version"
2929
},
3030
"require-dev": {
31-
"symfony/locale": "~2.0,>=2.0.5",
31+
"symfony/intl": "~2.3",
3232
"symfony/routing": "~2.2",
3333
"symfony/translation": "~2.0,>=2.0.5",
3434
"symfony/validator": "~2.5,>=2.5.5",

0 commit comments

Comments
 (0)