Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit db88330

Browse filesBrowse files
[SecurityBundle] Dont throw if "security.http_utils" is not found
1 parent 8633f64 commit db88330
Copy full SHA for db88330

File tree

Expand file treeCollapse file tree

2 files changed

+1
-15
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+1
-15
lines changed

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ class AddSessionDomainConstraintPass implements CompilerPassInterface
2626
*/
2727
public function process(ContainerBuilder $container)
2828
{
29-
if (!$container->hasParameter('session.storage.options')) {
29+
if (!$container->hasParameter('session.storage.options') || !$container->has('security.http_utils')) {
3030
return;
3131
}
3232

3333
$sessionOptions = $container->getParameter('session.storage.options');
3434
$domainRegexp = empty($sessionOptions['cookie_domain']) ? '%s' : sprintf('(?:%%s|(?:.+\.)?%s)', preg_quote(trim($sessionOptions['cookie_domain'], '.')));
3535
$domainRegexp = (empty($sessionOptions['cookie_secure']) ? 'https?://' : 'https://').$domainRegexp;
3636

37-
// if the service doesn't exist, an exception must be thrown - ignoring would put security at risk
3837
$container->findDefinition('security.http_utils')->addArgument(sprintf('{^%s$}i', $domainRegexp));
3938
}
4039
}

‎src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php
-13Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,6 @@ public function testNoSession()
9696
$this->assertTrue($utils->createRedirectResponse($request, 'http://pirate.com/foo')->isRedirect('http://pirate.com/foo'));
9797
}
9898

99-
/**
100-
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
101-
* @expectedExceptionMessage You have requested a non-existent service "security.http_utils".
102-
*/
103-
public function testNoHttpUtils()
104-
{
105-
$container = new ContainerBuilder();
106-
$container->setParameter('session.storage.options', array());
107-
108-
$pass = new AddSessionDomainConstraintPass();
109-
$pass->process($container);
110-
}
111-
11299
private function createContainer($sessionStorageOptions)
113100
{
114101
$container = new ContainerBuilder();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.