From 7ee39a630d3c69e93274c6d1d6ac54055cb2c48a Mon Sep 17 00:00:00 2001 From: Piotr Antosik Date: Thu, 22 Aug 2013 00:25:28 +0200 Subject: [PATCH 1/7] Added doc comments --- src/Symfony/Component/Security/Http/AccessMap.php | 3 +++ .../DefaultAuthenticationFailureHandler.php | 2 +- .../Authorization/AccessDeniedHandlerInterface.php | 1 + .../EntryPoint/BasicAuthenticationEntryPoint.php | 3 +++ .../EntryPoint/DigestAuthenticationEntryPoint.php | 9 +++++++++ .../Http/EntryPoint/FormAuthenticationEntryPoint.php | 2 +- .../EntryPoint/RetryAuthenticationEntryPoint.php | 3 +++ .../Security/Http/Event/InteractiveLoginEvent.php | 6 +++++- .../Security/Http/Event/SwitchUserEvent.php | 12 +++++++++++- src/Symfony/Component/Security/Http/Firewall.php | 3 +++ .../Security/Http/Firewall/ExceptionListener.php | 10 ++++++++++ .../Security/Http/Firewall/LogoutListener.php | 5 ++--- .../Security/Http/Firewall/RememberMeListener.php | 2 +- .../Http/Firewall/X509AuthenticationListener.php | 3 +++ src/Symfony/Component/Security/Http/FirewallMap.php | 8 ++++++++ src/Symfony/Component/Security/Http/HttpUtils.php | 7 ++++++- .../Http/RememberMe/AbstractRememberMeServices.php | 9 ++++++++- .../Security/Http/RememberMe/ResponseListener.php | 6 ++++++ 18 files changed, 84 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Security/Http/AccessMap.php b/src/Symfony/Component/Security/Http/AccessMap.php index de78e15a55..051a8c22b1 100644 --- a/src/Symfony/Component/Security/Http/AccessMap.php +++ b/src/Symfony/Component/Security/Http/AccessMap.php @@ -36,6 +36,9 @@ class AccessMap implements AccessMapInterface $this->map[] = array($requestMatcher, $roles, $channel); } + /** + * {@inheritDoc} + */ public function getPatterns(Request $request) { foreach ($this->map as $elements) { diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php index 64f84f0e9f..70dcd1e858 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php @@ -64,7 +64,7 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle { if ($failureUrl = $request->get($this->options['failure_path_parameter'], null, true)) { $this->options['failure_path'] = $failureUrl; - } + } if (null === $this->options['failure_path']) { $this->options['failure_path'] = $this->options['login_path']; diff --git a/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php b/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php index 5f60fd6aa1..262ccc5fbc 100644 --- a/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Http\Authorization; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; diff --git a/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php index 44ece5e72e..e03de7d5b4 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php @@ -30,6 +30,9 @@ class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface $this->realmName = $realmName; } + /** + * {@inheritdoc} + */ public function start(Request $request, AuthenticationException $authException = null) { $response = new Response(); diff --git a/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php index 1131b58917..4029d790c2 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php @@ -38,6 +38,9 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac $this->logger = $logger; } + /** + * {@inheritdoc} + */ public function start(Request $request, AuthenticationException $authException = null) { $expiryTime = microtime(true) + $this->nonceValiditySeconds * 1000; @@ -62,11 +65,17 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac return $response; } + /** + * @return string + */ public function getKey() { return $this->key; } + /** + * @return string + */ public function getRealmName() { return $this->realmName; diff --git a/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php index 2170e9ede7..886872a29b 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php @@ -30,7 +30,7 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface private $httpUtils; /** - * Constructor + * Constructor. * * @param HttpKernelInterface $kernel * @param HttpUtils $httpUtils An HttpUtils instance diff --git a/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php index 532601affa..091e0ee9b1 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php @@ -34,6 +34,9 @@ class RetryAuthenticationEntryPoint implements AuthenticationEntryPointInterface $this->httpsPort = $httpsPort; } + /** + * {@inheritdoc} + */ public function start(Request $request, AuthenticationException $authException = null) { $scheme = $request->isSecure() ? 'http' : 'https'; diff --git a/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php b/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php index 2225d92539..575352cd15 100644 --- a/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php +++ b/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php @@ -15,10 +15,14 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +/** + * InteractiveLoginEvent + * + * @author Fabien Potencier + */ class InteractiveLoginEvent extends Event { private $request; - private $authenticationToken; /** diff --git a/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php b/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php index 4a7dcaf86a..a55315449f 100644 --- a/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php +++ b/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php @@ -15,10 +15,14 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\EventDispatcher\Event; +/** + * SwitchUserEvent + * + * @author Fabien Potencier + */ class SwitchUserEvent extends Event { private $request; - private $targetUser; public function __construct(Request $request, UserInterface $targetUser) @@ -27,11 +31,17 @@ class SwitchUserEvent extends Event $this->targetUser = $targetUser; } + /** + * @return Request + */ public function getRequest() { return $this->request; } + /** + * @return UserInterface + */ public function getTargetUser() { return $this->targetUser; diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index 31c1da58ae..4f1cf30d03 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -71,6 +71,9 @@ class Firewall implements EventSubscriberInterface } } + /** + * {@inheritDoc} + */ public static function getSubscribedEvents() { return array(KernelEvents::REQUEST => array('onKernelRequest', 8)); diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index b2c8862b72..4ef6c26c88 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -161,6 +161,13 @@ class ExceptionListener $event->setResponse($response); } + /** + * @param Request $request + * @param AuthenticationException $authException + * + * @return Response + * @throws AuthenticationException + */ private function startAuthentication(Request $request, AuthenticationException $authException) { if (null === $this->authenticationEntryPoint) { @@ -181,6 +188,9 @@ class ExceptionListener return $this->authenticationEntryPoint->start($request, $authException); } + /** + * @param Request $request + */ protected function setTargetPath(Request $request) { // session isn't required when using http basic authentication mechanism for example diff --git a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php index 653c64429b..983eab0a31 100644 --- a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php @@ -37,7 +37,7 @@ class LogoutListener implements ListenerInterface private $csrfProvider; /** - * Constructor + * Constructor. * * @param SecurityContextInterface $securityContext * @param HttpUtils $httpUtils An HttpUtilsInterface instance @@ -77,9 +77,8 @@ class LogoutListener implements ListenerInterface * * @param GetResponseEvent $event A GetResponseEvent instance * - * @throws InvalidCsrfTokenException if the CSRF token is invalid + * @throws LogoutException if the CSRF token is invalid * @throws \RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response - * @throws LogoutException */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php index 5a856e27f4..6ca384296c 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php @@ -35,7 +35,7 @@ class RememberMeListener implements ListenerInterface private $dispatcher; /** - * Constructor + * Constructor. * * @param SecurityContextInterface $securityContext * @param RememberMeServicesInterface $rememberMeServices diff --git a/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php index 0b5a6ae540..5aabf75fcf 100644 --- a/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php @@ -36,6 +36,9 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener $this->credentialKey = $credentialKey; } + /** + * {@inheritdoc} + */ protected function getPreAuthenticatedData(Request $request) { if (!$request->server->has($this->userKey)) { diff --git a/src/Symfony/Component/Security/Http/FirewallMap.php b/src/Symfony/Component/Security/Http/FirewallMap.php index dfc0984415..0554bedc21 100644 --- a/src/Symfony/Component/Security/Http/FirewallMap.php +++ b/src/Symfony/Component/Security/Http/FirewallMap.php @@ -25,11 +25,19 @@ class FirewallMap implements FirewallMapInterface { private $map = array(); + /** + * @param RequestMatcherInterface $requestMatcher + * @param array $listeners + * @param ExceptionListener $exceptionListener + */ public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = array(), ExceptionListener $exceptionListener = null) { $this->map[] = array($requestMatcher, $listeners, $exceptionListener); } + /** + * {@inheritDoc} + */ public function getListeners(Request $request) { foreach ($this->map as $elements) { diff --git a/src/Symfony/Component/Security/Http/HttpUtils.php b/src/Symfony/Component/Security/Http/HttpUtils.php index c3ff865bae..0588359b2b 100644 --- a/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/src/Symfony/Component/Security/Http/HttpUtils.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Http; use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; @@ -37,6 +38,8 @@ class HttpUtils * * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance * @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher + * + * @throws \InvalidArgumentException */ public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatcher = null) { @@ -123,9 +126,11 @@ class HttpUtils * Generates a URI, based on the given path or absolute URL. * * @param Request $request A Request instance - * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) * * @return string An absolute URL + * + * @throws \LogicException */ public function generateUri($request, $path) { diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php index ae61dd73b1..6a47a7ad7a 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php @@ -40,7 +40,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface private $userProviders; /** - * Constructor + * Constructor. * * @param array $userProviders * @param string $key @@ -80,6 +80,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface return $this->options['remember_me_parameter']; } + /** + * @return string + */ public function getKey() { return $this->key; @@ -94,6 +97,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface * @return TokenInterface|null * * @throws CookieTheftException + * @throws \RuntimeException */ final public function autoLogin(Request $request) { @@ -219,6 +223,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface */ abstract protected function processAutoLoginCookie(array $cookieParts, Request $request); + /** + * @param Request $request + */ protected function onLoginFail(Request $request) { } diff --git a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php index 03c71c78dc..60875877ef 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php +++ b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php @@ -22,6 +22,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class ResponseListener implements EventSubscriberInterface { + /** + * @param FilterResponseEvent $event + */ public function onKernelResponse(FilterResponseEvent $event) { $request = $event->getRequest(); @@ -32,6 +35,9 @@ class ResponseListener implements EventSubscriberInterface } } + /** + * {@inheritDoc} + */ public static function getSubscribedEvents() { return array(KernelEvents::RESPONSE => 'onKernelResponse'); From d997443ab06c506b2767cc6241185851222409a7 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Mon, 23 Sep 2013 10:18:01 +0200 Subject: [PATCH 2/7] [HttpFoundation] Header `HTTP_X_FORWARDED_PROTO` can contain various values Some proxies use `ssl` instead of `https`, as well as Lighttpd mod_proxy allows value chaining (`https, http`, where `https` is always first when request is encrypted). --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- src/Symfony/Component/HttpFoundation/Tests/RequestTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index f99a091e2e..c2ae20507c 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1066,7 +1066,7 @@ class Request public function isSecure() { if (self::$trustProxy && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && $proto = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO])) { - return in_array(strtolower($proto), array('https', 'on', '1')); + return in_array(strtolower(current(explode(',', $proto))), array('https', 'on', 'ssl', '1')); } return 'on' == strtolower($this->server->get('HTTPS')) || 1 == $this->server->get('HTTPS'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 0741b9db6c..20ad1471aa 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1438,6 +1438,13 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); + // check various X_FORWARDED_PROTO header values + $request->headers->set('X_FORWARDED_PROTO', 'ssl'); + $this->assertTrue($request->isSecure()); + + $request->headers->set('X_FORWARDED_PROTO', 'https, http'); + $this->assertTrue($request->isSecure()); + // custom header names Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_MY_FOR'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_MY_HOST'); From 54e2abd2ce6ebc26e4aafc4f62174bf1a462fc99 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 26 Sep 2013 21:07:06 +0200 Subject: [PATCH 3/7] [Routing] removed extra argument --- src/Symfony/Component/Routing/Router.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index fe638792b1..d75d5c1cdf 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -232,7 +232,7 @@ class Router implements RouterInterface $class = $this->options['matcher_cache_class']; $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); - if (!$cache->isFresh($class)) { + if (!$cache->isFresh()) { $dumper = new $this->options['matcher_dumper_class']($this->getRouteCollection()); $options = array( @@ -264,7 +264,7 @@ class Router implements RouterInterface } else { $class = $this->options['generator_cache_class']; $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); - if (!$cache->isFresh($class)) { + if (!$cache->isFresh()) { $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection()); $options = array( From bb0125b2f9fd8954648199f70ae88785001b7960 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 26 Sep 2013 23:39:53 +0100 Subject: [PATCH 4/7] [DependencyInjection] Prevented inlining of lazy loaded private service definitions. --- .../Compiler/InlineServiceDefinitionsPass.php | 2 +- .../InlineServiceDefinitionsPassTest.php | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index ab8895a8c9..2868cca63f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -117,7 +117,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface return true; } - if ($definition->isPublic()) { + if ($definition->isPublic() || $definition->isLazy()) { return false; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php index f22f0da9f8..986e4047e9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -12,10 +12,8 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use Symfony\Component\DependencyInjection\Scope; - use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; -use Symfony\Component\DependencyInjection\Compiler\Compiler; use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass; use Symfony\Component\DependencyInjection\Reference; @@ -126,6 +124,26 @@ class InlineServiceDefinitionsPassTest extends \PHPUnit_Framework_TestCase $this->assertTrue($container->hasDefinition('a')); } + public function testProcessDoesNotInlineWhenServiceIsPrivateButLazy() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ->setLazy(true) + ; + + $container + ->register('service') + ->setArguments(array($ref = new Reference('foo'))) + ; + + $this->process($container); + + $arguments = $container->getDefinition('service')->getArguments(); + $this->assertSame($ref, $arguments[0]); + } + protected function process(ContainerBuilder $container) { $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass())); From 27cc10c660606a53e4c80492c88eaa70649cbdc2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Sep 2013 18:31:48 +0200 Subject: [PATCH 5/7] [Security] fixed wrong phpdoc --- src/Symfony/Component/Security/Http/HttpUtils.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Symfony/Component/Security/Http/HttpUtils.php b/src/Symfony/Component/Security/Http/HttpUtils.php index 0588359b2b..65ab914669 100644 --- a/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/src/Symfony/Component/Security/Http/HttpUtils.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http; use Symfony\Component\Security\Core\SecurityContextInterface; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; @@ -21,7 +20,6 @@ use Symfony\Component\Routing\Matcher\RequestMatcherInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\HttpFoundation\Response; /** * Encapsulates the logic needed to create sub-requests, redirect the user, and match URLs. @@ -57,7 +55,7 @@ class HttpUtils * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) * @param integer $status The status code * - * @return Response A RedirectResponse instance + * @return RedirectResponse A RedirectResponse instance */ public function createRedirectResponse(Request $request, $path, $status = 302) { From 5e2ac93f989fe102980fe8a9c543065952309288 Mon Sep 17 00:00:00 2001 From: Thomas Schulz Date: Sun, 8 Sep 2013 18:07:40 +0200 Subject: [PATCH 6/7] Fix problem with Windows file links (backslash in JavaScript string) --- .../Resources/views/Collector/request.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig index 3bff903a89..8e5df5ebbd 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig @@ -5,7 +5,7 @@ {% if collector.controller.class is defined %} {% set link = collector.controller.file|file_link(collector.controller.line) %} {{ collector.controller.class|abbr_class }} - + {{ collector.controller.method }} {% else %} From 8c8cf620382fed360d42c8d7a29609895dc70413 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 29 Sep 2013 21:03:21 +0200 Subject: [PATCH 7/7] fixed Client when using the terminable event --- src/Symfony/Bundle/FrameworkBundle/Client.php | 7 +++++-- src/Symfony/Component/HttpKernel/Client.php | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 52efc80619..ff7cde9f43 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -156,7 +156,7 @@ class Client extends BaseClient $profilerCode = '$kernel->getContainer()->get(\'profiler\')->enable();'; } - return <<boot(); $profilerCode -echo serialize(\$kernel->handle(unserialize('$request'))); + +\$request = unserialize('$request'); EOF; + + return $code.$this->getHandleScript(); } } diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 1618885715..2d7f2c7ab7 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -84,7 +84,7 @@ class Client extends BaseClient $requirePath = str_replace("'", "\\'", $r->getFileName()); $symfonyPath = str_replace("'", "\\'", realpath(__DIR__.'/../../..')); - return <<register(); \$kernel = unserialize('$kernel'); -echo serialize(\$kernel->handle(unserialize('$request'))); +\$request = unserialize('$request'); +EOF; + + return $code.$this->getHandleScript(); + } + + protected function getHandleScript() + { + return <<<'EOF' +$response = $kernel->handle($request); + +if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) { + $kernel->terminate($request, $response); +} + +echo serialize($response); EOF; }