diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 1819649769..5435d778c9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -160,7 +160,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/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig index 9c0ea3fb5e..6d49116b0b 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 %} 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())); diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index c1bd62c3fa..5ddd4d5dda 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1091,7 +1091,7 @@ class Request public function isSecure() { if (self::$trustedProxies && 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 b8bbf15ab8..13a44e08b5 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1442,6 +1442,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'); diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 84ff3b99e4..13e6d50cdc 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -104,7 +104,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; } diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index cb1eb5f856..e4e26b1d11 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -266,8 +266,13 @@ class Router implements RouterInterface } else { $class = $this->options['generator_cache_class']; $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); +<<<<<<< HEAD if (!$cache->isFresh($class)) { $dumper = $this->getGeneratorDumperInstance(); +======= + if (!$cache->isFresh()) { + $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection()); +>>>>>>> 2.3 $options = array( 'class' => $class, diff --git a/src/Symfony/Component/Security/Http/AccessMap.php b/src/Symfony/Component/Security/Http/AccessMap.php index bf1d54081a..dc2e66a03a 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, $attributes, $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 3eaae820c3..45a7ea9fda 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 5a1e9d5647..98fda5ec6c 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -84,6 +84,9 @@ class Firewall implements EventSubscriberInterface } } + /** + * {@inheritDoc} + */ public static function getSubscribedEvents() { return array( diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index 0cca0c46cc..c1f29f783a 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -167,6 +167,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) { @@ -187,6 +194,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..65ab914669 100644 --- a/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/src/Symfony/Component/Security/Http/HttpUtils.php @@ -20,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. @@ -37,6 +36,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) { @@ -54,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) { @@ -123,9 +124,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');