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 61fc221

Browse filesBrowse files
Merge branch '4.1'
* 4.1: (22 commits) Fix CS [PropertyInfo] fix resolving parent|self type hints fixed CS fix merge [Security] Fix logout Cleanup 2 tests for the HttpException classes #27250 limiting GET_LOCK key up to 64 char due to changes in MySQL 5.7.5 and later [Config] Fix tests when path contains UTF chars [DI] Shared services should not be inlined in non-shared ones [Profiler] Remove propel & event_listener_loading category identifiers [Filesystem] Fix usages of error_get_last() [Cache][Lock] Fix usages of error_get_last() [Debug] Fix populating error_get_last() for handled silent errors fixed CS fixed CS fixed CS [FrameworkBundle] Fix cache:clear on vagrant [HttpKernel] Handle NoConfigurationException "onKernelException()" Fix misses calculation when calling getItems [DI] Display previous error messages when throwing unused bindings ...
2 parents 4a7e6fa + 71a1e29 commit 61fc221
Copy full SHA for 61fc221

File tree

87 files changed

+520
-250
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

87 files changed

+520
-250
lines changed

‎src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public function guessType($class, $property)
6060
case Type::DATETIMETZ:
6161
case 'vardatetime':
6262
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', array(), Guess::HIGH_CONFIDENCE);
63-
case 'datetime_immutable';
64-
case 'datetimetz_immutable';
63+
case 'datetime_immutable':
64+
case 'datetimetz_immutable':
6565
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', array('input' => 'datetime_immutable'), Guess::HIGH_CONFIDENCE);
6666
case 'dateinterval':
6767
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateIntervalType', array(), Guess::HIGH_CONFIDENCE);

‎src/Symfony/Bridge/Monolog/Handler/FingersCrossed/NotFoundActivationStrategy.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Handler/FingersCrossed/NotFoundActivationStrategy.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function isHandlerActivated(array $record)
4242
$isActivated
4343
&& isset($record['context']['exception'])
4444
&& $record['context']['exception'] instanceof HttpException
45-
&& $record['context']['exception']->getStatusCode() == 404
45+
&& 404 == $record['context']['exception']->getStatusCode()
4646
&& ($request = $this->requestStack->getMasterRequest())
4747
) {
4848
return !preg_match($this->blacklist, $request->getPathInfo());

‎src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\PhpUnit\Legacy;
1313

14-
use PHPUnit\Framework\Test;
1514
use PHPUnit\Framework\TestCase;
1615
use PHPUnit\Framework\Warning;
1716

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ while (!file_exists($vendor.'/vendor')) {
1515
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
1616
require PHPUNIT_COMPOSER_INSTALL;
1717
require_once __DIR__.'/../../bootstrap.php';
18-
eval("@trigger_error('who knows where I come from?', E_USER_DEPRECATED);")
18+
eval("@trigger_error('who knows where I come from?', E_USER_DEPRECATED);");
1919

2020
?>
2121
--EXPECTF--

‎src/Symfony/Bridge/Twig/NodeVisitor/Scope.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/NodeVisitor/Scope.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Scope
2020
private $data = array();
2121
private $left = false;
2222

23-
public function __construct(Scope $parent = null)
23+
public function __construct(self $parent = null)
2424
{
2525
$this->parent = $parent;
2626
}

‎src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+24-6Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,33 @@ protected function execute(InputInterface $input, OutputInterface $output)
129129
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
130130
}
131131

132-
$containerDir = $fs->exists($warmupDir.'/'.$containerDir) ? false : $containerDir;
132+
if (!$fs->exists($warmupDir.'/'.$containerDir)) {
133+
$fs->rename($realCacheDir.'/'.$containerDir, $warmupDir.'/'.$containerDir);
134+
touch($warmupDir.'/'.$containerDir.'.legacy');
135+
}
133136

134-
$fs->rename($realCacheDir, $oldCacheDir);
135-
$fs->rename($warmupDir, $realCacheDir);
137+
if ('/' === \DIRECTORY_SEPARATOR && $mounts = @file('/proc/mounts')) {
138+
foreach ($mounts as $mount) {
139+
$mount = array_slice(explode(' ', $mount), 1, -3);
140+
if (!\in_array(array_pop($mount), array('vboxfs', 'nfs'))) {
141+
continue;
142+
}
143+
$mount = implode(' ', $mount).'/';
144+
145+
if (0 === strpos($realCacheDir, $mount)) {
146+
$io->note('For better performances, you should move the cache and log directories to a non-shared folder of the VM.');
147+
$oldCacheDir = false;
148+
break;
149+
}
150+
}
151+
}
136152

137-
if ($containerDir) {
138-
$fs->rename($oldCacheDir.'/'.$containerDir, $realCacheDir.'/'.$containerDir);
139-
touch($realCacheDir.'/'.$containerDir.'.legacy');
153+
if ($oldCacheDir) {
154+
$fs->rename($realCacheDir, $oldCacheDir);
155+
} else {
156+
$fs->remove($realCacheDir);
140157
}
158+
$fs->rename($warmupDir, $realCacheDir);
141159

142160
if ($output->isVerbose()) {
143161
$io->comment('Removing old cache directory...');

‎src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
1313

1414
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15-
use Symfony\Component\HttpFoundation\File\File;
1615

1716
class ControllerTest extends ControllerTraitTest
1817
{

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+14-14Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,15 @@ private function createFirewalls($config, ContainerBuilder $container)
197197

198198
$configId = 'security.firewall.map.config.'.$name;
199199

200-
list($matcher, $listeners, $exceptionListener) = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId);
200+
list($matcher, $listeners, $exceptionListener, $logoutListener) = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId);
201201

202202
$contextId = 'security.firewall.map.context.'.$name;
203203
$context = $container->setDefinition($contextId, new ChildDefinition('security.firewall.context'));
204204
$context
205205
->replaceArgument(0, new IteratorArgument($listeners))
206206
->replaceArgument(1, $exceptionListener)
207-
->replaceArgument(2, new Reference($configId))
207+
->replaceArgument(2, $logoutListener)
208+
->replaceArgument(3, new Reference($configId))
208209
;
209210

210211
$contextRefs[$contextId] = new Reference($contextId);
@@ -250,7 +251,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
250251

251252
// Security disabled?
252253
if (false === $firewall['security']) {
253-
return array($matcher, array(), null);
254+
return array($matcher, array(), null, null);
254255
}
255256

256257
$config->replaceArgument(4, $firewall['stateless']);
@@ -289,16 +290,15 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
289290
$config->replaceArgument(6, $contextKey);
290291

291292
// Logout listener
293+
$logoutListenerId = null;
292294
if (isset($firewall['logout'])) {
293-
$listenerKeys[] = 'logout';
294-
$listenerId = 'security.logout_listener.'.$id;
295-
$listener = $container->setDefinition($listenerId, new ChildDefinition('security.logout_listener'));
296-
$listener->replaceArgument(3, array(
295+
$logoutListenerId = 'security.logout_listener.'.$id;
296+
$logoutListener = $container->setDefinition($logoutListenerId, new ChildDefinition('security.logout_listener'));
297+
$logoutListener->replaceArgument(3, array(
297298
'csrf_parameter' => $firewall['logout']['csrf_parameter'],
298299
'csrf_token_id' => $firewall['logout']['csrf_token_id'],
299300
'logout_path' => $firewall['logout']['path'],
300301
));
301-
$listeners[] = new Reference($listenerId);
302302

303303
// add logout success handler
304304
if (isset($firewall['logout']['success_handler'])) {
@@ -308,16 +308,16 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
308308
$logoutSuccessHandler = $container->setDefinition($logoutSuccessHandlerId, new ChildDefinition('security.logout.success_handler'));
309309
$logoutSuccessHandler->replaceArgument(1, $firewall['logout']['target']);
310310
}
311-
$listener->replaceArgument(2, new Reference($logoutSuccessHandlerId));
311+
$logoutListener->replaceArgument(2, new Reference($logoutSuccessHandlerId));
312312

313313
// add CSRF provider
314314
if (isset($firewall['logout']['csrf_token_generator'])) {
315-
$listener->addArgument(new Reference($firewall['logout']['csrf_token_generator']));
315+
$logoutListener->addArgument(new Reference($firewall['logout']['csrf_token_generator']));
316316
}
317317

318318
// add session logout handler
319319
if (true === $firewall['logout']['invalidate_session'] && false === $firewall['stateless']) {
320-
$listener->addMethodCall('addHandler', array(new Reference('security.logout.handler.session')));
320+
$logoutListener->addMethodCall('addHandler', array(new Reference('security.logout.handler.session')));
321321
}
322322

323323
// add cookie logout handler
@@ -326,12 +326,12 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
326326
$cookieHandler = $container->setDefinition($cookieHandlerId, new ChildDefinition('security.logout.handler.cookie_clearing'));
327327
$cookieHandler->addArgument($firewall['logout']['delete_cookies']);
328328

329-
$listener->addMethodCall('addHandler', array(new Reference($cookieHandlerId)));
329+
$logoutListener->addMethodCall('addHandler', array(new Reference($cookieHandlerId)));
330330
}
331331

332332
// add custom handlers
333333
foreach ($firewall['logout']['handlers'] as $handlerId) {
334-
$listener->addMethodCall('addHandler', array(new Reference($handlerId)));
334+
$logoutListener->addMethodCall('addHandler', array(new Reference($handlerId)));
335335
}
336336

337337
// register with LogoutUrlGenerator
@@ -391,7 +391,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
391391
$config->replaceArgument(10, $listenerKeys);
392392
$config->replaceArgument(11, isset($firewall['switch_user']) ? $firewall['switch_user'] : null);
393393

394-
return array($matcher, $listeners, $exceptionListener);
394+
return array($matcher, $listeners, $exceptionListener, null !== $logoutListenerId ? new Reference($logoutListenerId) : null);
395395
}
396396

397397
private function createContextListener($container, $contextKey)

‎src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
<service id="security.firewall.context" class="Symfony\Bundle\SecurityBundle\Security\FirewallContext" abstract="true">
142142
<argument type="collection" />
143143
<argument type="service" id="security.exception_listener" />
144+
<argument /> <!-- LogoutListener -->
144145
<argument /> <!-- FirewallConfig -->
145146
</service>
146147

‎src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php
+19-2Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\SecurityBundle\Security;
1313

1414
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
15+
use Symfony\Component\Security\Http\Firewall\LogoutListener;
1516

1617
/**
1718
* This is a wrapper around the actual firewall configuration which allows us
@@ -23,13 +24,24 @@ class FirewallContext
2324
{
2425
private $listeners;
2526
private $exceptionListener;
27+
private $logoutListener;
2628
private $config;
2729

28-
public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null)
30+
/**
31+
* @param LogoutListener|null $logoutListener
32+
*/
33+
public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, $logoutListener = null, FirewallConfig $config = null)
2934
{
3035
$this->listeners = $listeners;
3136
$this->exceptionListener = $exceptionListener;
32-
$this->config = $config;
37+
if ($logoutListener instanceof FirewallConfig) {
38+
$this->config = $logoutListener;
39+
} elseif (null === $logoutListener || $logoutListener instanceof LogoutListener) {
40+
$this->logoutListener = $logoutListener;
41+
$this->config = $config;
42+
} else {
43+
throw new \InvalidArgumentException(sprintf('Argument 3 passed to %s() must be instance of %s or null, %s given.', __METHOD__, LogoutListener::class, is_object($logoutListener) ? get_class($logoutListener) : gettype($logoutListener)));
44+
}
3345
}
3446

3547
public function getConfig()
@@ -46,4 +58,9 @@ public function getExceptionListener()
4658
{
4759
return $this->exceptionListener;
4860
}
61+
62+
public function getLogoutListener()
63+
{
64+
return $this->logoutListener;
65+
}
4966
}

‎src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function getListeners(Request $request)
4040
$context = $this->getFirewallContext($request);
4141

4242
if (null === $context) {
43-
return array(array(), null);
43+
return array(array(), null, null);
4444
}
4545

46-
return array($context->getListeners(), $context->getExceptionListener());
46+
return array($context->getListeners(), $context->getExceptionListener(), $context->getLogoutListener());
4747
}
4848

4949
/**

‎src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testFirewalls()
7171
$arguments = $contextDef->getArguments();
7272
$listeners[] = array_map('strval', $arguments['index_0']->getValues());
7373

74-
$configDef = $container->getDefinition((string) $arguments['index_2']);
74+
$configDef = $container->getDefinition((string) $arguments['index_3']);
7575
$configs[] = array_values($configDef->getArguments());
7676
}
7777

@@ -99,7 +99,6 @@ public function testFirewalls()
9999
null,
100100
null,
101101
array(
102-
'logout',
103102
'switch_user',
104103
'x509',
105104
'remote_user',
@@ -171,7 +170,6 @@ public function testFirewalls()
171170
array(),
172171
array(
173172
'security.channel_listener',
174-
'security.logout_listener.secure',
175173
'security.authentication.listener.x509.secure',
176174
'security.authentication.listener.remote_user.secure',
177175
'security.authentication.listener.form.secure',
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
13+
14+
class LogoutTest extends WebTestCase
15+
{
16+
public function testSessionLessRememberMeLogout()
17+
{
18+
$client = $this->createClient(array('test_case' => 'RememberMeLogout', 'root_config' => 'config.yml'));
19+
20+
$client->request('POST', '/login', array(
21+
'_username' => 'johannes',
22+
'_password' => 'test',
23+
));
24+
25+
$cookieJar = $client->getCookieJar();
26+
$cookieJar->expire(session_name());
27+
28+
$this->assertNotNull($cookieJar->get('REMEMBERME'));
29+
30+
$client->request('GET', '/logout');
31+
32+
$this->assertNull($cookieJar->get('REMEMBERME'));
33+
}
34+
}
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
use Symfony\Bundle\SecurityBundle\SecurityBundle;
13+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
14+
15+
return array(
16+
new FrameworkBundle(),
17+
new SecurityBundle(),
18+
);
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
imports:
2+
- { resource: ./../config/framework.yml }
3+
4+
security:
5+
encoders:
6+
Symfony\Component\Security\Core\User\User: plaintext
7+
8+
providers:
9+
in_memory:
10+
memory:
11+
users:
12+
johannes: { password: test, roles: [ROLE_USER] }
13+
14+
firewalls:
15+
default:
16+
form_login:
17+
check_path: login
18+
remember_me: true
19+
require_previous_session: false
20+
remember_me:
21+
always_remember_me: true
22+
secret: key
23+
logout: ~
24+
anonymous: ~
25+
stateless: true
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
login:
2+
path: /login
3+
4+
logout:
5+
path: /logout

0 commit comments

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