From ad30087264a4e26842984a6ad5a7f2f549779722 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 3 Apr 2018 08:18:41 +0200 Subject: [PATCH 01/19] bumped Symfony version to 3.4.8 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index d092db6a354b4..7cb3621744d3e 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.7'; - const VERSION_ID = 30407; + const VERSION = '3.4.8-DEV'; + const VERSION_ID = 30408; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 7; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 8; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From e074c0550cc3e8a3d59b4174a785d365a28733e2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 3 Apr 2018 12:04:49 +0200 Subject: [PATCH 02/19] [WebProfilerBundle][HttpKernel] Make FileLinkFormatter URL format generation lazy --- .../WebProfilerExtension.php | 8 +++++++ .../Resources/config/profiler.xml | 22 +++++++------------ .../HttpKernel/Debug/FileLinkFormatter.php | 21 ++++++++++++++++++ 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php index 7a17e7fb10e6a..932308e993cf6 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php @@ -11,10 +11,13 @@ namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Config\FileLocator; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener; /** @@ -53,6 +56,11 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']); $container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED); } + + if (Kernel::VERSION_ID >= 30408 || Kernel::VERSION_ID >= 40008) { + $container->getDefinition('debug.file_link_formatter') + ->replaceArgument(3, new ServiceClosureArgument(new Reference('debug.file_link_formatter.url_format'))); + } } /** diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml index f56b1f2f50d1a..7854bc199cb2e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml @@ -56,20 +56,14 @@ %debug.file_link_format% %kernel.project_dir% - - - - - - - - _profiler_open_file - - - ?file=%%f&line=%%l#line%%l - - - + /_profiler/open?file=%%f&line=%%l#line%%l + + + + + + _profiler_open_file + ?file=%%f&line=%%l#line%%l diff --git a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php index c340d9b67200a..1a72ac7e25853 100644 --- a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php +++ b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php @@ -13,6 +13,8 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Routing\Exception\ExceptionInterface; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** * Formats debug file links. @@ -26,6 +28,9 @@ class FileLinkFormatter implements \Serializable private $baseDir; private $urlFormat; + /** + * @param string|\Closure $urlFormat the URL format, or a closure that returns it on-demand + */ public function __construct($fileLinkFormat = null, RequestStack $requestStack = null, $baseDir = null, $urlFormat = null) { $fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); @@ -70,6 +75,18 @@ public function unserialize($serialized) } } + /** + * @internal + */ + public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString) + { + try { + return $router->generate($routeName).$queryString; + } catch (ExceptionInterface $e) { + return null; + } + } + private function getFileLinkFormat() { if ($this->fileLinkFormat) { @@ -78,6 +95,10 @@ private function getFileLinkFormat() if ($this->requestStack && $this->baseDir && $this->urlFormat) { $request = $this->requestStack->getMasterRequest(); if ($request instanceof Request) { + if ($this->urlFormat instanceof \Closure && !$this->urlFormat = \call_user_func($this->urlFormat)) { + return; + } + return array( $request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat, $this->baseDir.DIRECTORY_SEPARATOR, '', From f9216edad8926745287016d05bdbf76332d723db Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Tue, 3 Apr 2018 17:11:58 +0200 Subject: [PATCH 03/19] [VarDumper] Skip some tests on custom xdebug.file_link_format --- .../Component/VarDumper/Tests/Caster/ExceptionCasterTest.php | 4 ++++ .../Component/VarDumper/Tests/Dumper/HtmlDumperTest.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php index 92cf6fb88299c..c9cc24f2dff62 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php @@ -126,6 +126,10 @@ public function testNoSrcContext() public function testHtmlDump() { + if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { + $this->markTestSkipped('A custom file_link_format is defined.'); + } + $e = $this->getTestException(1); ExceptionCaster::$srcContext = -1; diff --git a/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php b/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php index b852f27476d0a..eac82644f9318 100644 --- a/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php @@ -22,6 +22,10 @@ class HtmlDumperTest extends TestCase { public function testGet() { + if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { + $this->markTestSkipped('A custom file_link_format is defined.'); + } + require __DIR__.'/../Fixtures/dumb-var.php'; $dumper = new HtmlDumper('php://output'); From cdde6d9353b7eefd487389f3da3958981af73554 Mon Sep 17 00:00:00 2001 From: Helmut Hummel Date: Tue, 3 Apr 2018 13:22:20 +0200 Subject: [PATCH 04/19] [Finder] Remove duplicate slashes in filenames --- src/Symfony/Component/Finder/Finder.php | 16 +++++++- src/Symfony/Component/Finder/SplFileInfo.php | 2 +- .../Component/Finder/Tests/FinderTest.php | 39 +++++++++++++++---- .../Tests/Iterator/FilePathsIteratorTest.php | 2 +- 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 8eb75fca62a42..8ebba9b9c650c 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -629,9 +629,9 @@ public function in($dirs) foreach ((array) $dirs as $dir) { if (is_dir($dir)) { - $resolvedDirs[] = $dir; + $resolvedDirs[] = $this->normalizeDir($dir); } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { - $resolvedDirs = array_merge($resolvedDirs, $glob); + $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob)); } else { throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); } @@ -794,4 +794,16 @@ private function resetAdapterSelection() return $properties; }, $this->adapters); } + + /** + * Normalizes given directory names by removing trailing slashes. + * + * @param string $dir + * + * @return string + */ + private function normalizeDir($dir) + { + return rtrim($dir, '/'.\DIRECTORY_SEPARATOR); + } } diff --git a/src/Symfony/Component/Finder/SplFileInfo.php b/src/Symfony/Component/Finder/SplFileInfo.php index 2cf3a27fa9f6b..19f95e26be69a 100644 --- a/src/Symfony/Component/Finder/SplFileInfo.php +++ b/src/Symfony/Component/Finder/SplFileInfo.php @@ -28,7 +28,7 @@ class SplFileInfo extends \SplFileInfo */ public function __construct($file, $relativePath, $relativePathname) { - parent::__construct(realpath($file) ?: $file); + parent::__construct($file); $this->relativePath = $relativePath; $this->relativePathname = $relativePathname; } diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index dd90c4e844b86..b240728c96810 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -50,15 +50,40 @@ public function testFiles() public function testRemoveTrailingSlash() { - if ('\\' === \DIRECTORY_SEPARATOR) { - $this->markTestSkipped('This test cannot be run on Windows.'); + $finder = $this->buildFinder(); + + $expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')); + $in = self::$tmpDir.'//'; + + $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); + } + + public function testSymlinksNotResolved() + { + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('symlinks are not supported on Windows'); } $finder = $this->buildFinder(); - $expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')); - $in = '//'.realpath(self::$tmpDir).'//'; + symlink($this->toAbsolute('foo'), $this->toAbsolute('baz')); + $expected = $this->toAbsolute(array('baz/bar.tmp')); + $in = self::$tmpDir.'/baz/'; + try { + $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); + unlink($this->toAbsolute('baz')); + } catch (\Exception $e) { + unlink($this->toAbsolute('baz')); + throw $e; + } + } + + public function testBackPathNotNormalized() + { + $finder = $this->buildFinder(); + $expected = $this->toAbsolute(array('foo/../foo/bar.tmp')); + $in = self::$tmpDir.'/foo/../foo/'; $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); } @@ -279,7 +304,7 @@ public function testInWithNonExistentDirectory() public function testInWithGlob() { $finder = $this->buildFinder(); - $finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator(); + $finder->in(array(__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'))->getIterator(); $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); } @@ -518,8 +543,8 @@ public function testMultipleLocationsWithSubDirectories() $finder->in($locations)->depth('< 10')->name('*.neon'); $expected = array( - __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', - __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', + __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', + __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', ); $this->assertIterator($expected, $finder); diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php index 3c805086afec2..fdf810bebd3db 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php @@ -31,7 +31,7 @@ public function testSubPath($baseDir, array $paths, array $subPaths, array $subP public function getSubPathData() { - $tmpDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'symfony_finder'; + $tmpDir = sys_get_temp_dir().'/symfony_finder'; return array( array( From 34bb83db0aa009eb9fececeb061755f8f8772645 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 4 Apr 2018 07:04:48 +0200 Subject: [PATCH 05/19] fixed tests --- src/Symfony/Component/Finder/Tests/BsdFinderTest.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Finder/Tests/BsdFinderTest.php b/src/Symfony/Component/Finder/Tests/BsdFinderTest.php index a7d800616625f..9ee08538735c8 100644 --- a/src/Symfony/Component/Finder/Tests/BsdFinderTest.php +++ b/src/Symfony/Component/Finder/Tests/BsdFinderTest.php @@ -19,7 +19,17 @@ */ class BsdFinderTest extends FinderTest { - protected function buildFinder() + public function testSymlinksNotResolved() + { + $this->markTestSkipped('not supported on BSD finder'); + } + + public function testBackPathNotNormalized() + { + $this->markTestSkipped('not supported on BSD finder'); + } + + protected function buildFinder() { $adapter = new BsdFindAdapter(); From 540ea112b59c4ed2fd02a263ce77a35afdcf1b52 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 4 Apr 2018 08:34:32 +0200 Subject: [PATCH 06/19] [Finder] fix tests --- src/Symfony/Component/Finder/Tests/BsdFinderTest.php | 10 ++++++++++ src/Symfony/Component/Finder/Tests/GnuFinderTest.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Symfony/Component/Finder/Tests/BsdFinderTest.php b/src/Symfony/Component/Finder/Tests/BsdFinderTest.php index 42691a4318531..101175253a7ca 100644 --- a/src/Symfony/Component/Finder/Tests/BsdFinderTest.php +++ b/src/Symfony/Component/Finder/Tests/BsdFinderTest.php @@ -15,6 +15,16 @@ class BsdFinderTest extends FinderTest { + public function testSymlinksNotResolved() + { + $this->markTestSkipped('Symlinks are always resolved using the BsdFinderAdapter.'); + } + + public function testBackPathNotNormalized() + { + $this->markTestSkipped('Paths are always normalized using the BsdFinderAdapter.'); + } + protected function getAdapter() { $adapter = new BsdFindAdapter(); diff --git a/src/Symfony/Component/Finder/Tests/GnuFinderTest.php b/src/Symfony/Component/Finder/Tests/GnuFinderTest.php index 5c66723c1bea1..48286d5a2d36a 100644 --- a/src/Symfony/Component/Finder/Tests/GnuFinderTest.php +++ b/src/Symfony/Component/Finder/Tests/GnuFinderTest.php @@ -15,6 +15,16 @@ class GnuFinderTest extends FinderTest { + public function testSymlinksNotResolved() + { + $this->markTestSkipped('Symlinks are always resolved using the GnuFinderAdapter.'); + } + + public function testBackPathNotNormalized() + { + $this->markTestSkipped('Paths are always normalized using the GnuFinderAdapter.'); + } + protected function getAdapter() { $adapter = new GnuFindAdapter(); From 1b26aac8d255b2a449e3874ce5ffe28a36c12689 Mon Sep 17 00:00:00 2001 From: Boris Vujicic Date: Tue, 3 Apr 2018 16:02:27 +0200 Subject: [PATCH 07/19] [SecurityBundle] Add missing argument to security.authentication.provider.simple --- .../Security/Factory/SimplePreAuthenticationFactory.php | 1 + .../SecurityBundle/Resources/config/security_listeners.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php index 27d8c5f050ec5..c1c6e48083856 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php @@ -49,6 +49,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider, ->replaceArgument(0, new Reference($config['authenticator'])) ->replaceArgument(1, new Reference($userProvider)) ->replaceArgument(2, $id) + ->replaceArgument(3, new Reference('security.user_checker.'.$id)) ; // listener diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml index 4f3515c3ac3b2..f7462045724b3 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml @@ -236,6 +236,7 @@ + null From 946eefa284fd8b8091ed38b944adc3dd33a3948c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 4 Apr 2018 14:14:22 +0200 Subject: [PATCH 08/19] [WebProfilerBundle] fix version check --- .../DependencyInjection/WebProfilerExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php index 932308e993cf6..2511618fd9b60 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php @@ -57,7 +57,7 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED); } - if (Kernel::VERSION_ID >= 30408 || Kernel::VERSION_ID >= 40008) { + if (Kernel::VERSION_ID >= 40008 || (Kernel::VERSION_ID >= 30408 && Kernel::VERSION_ID < 40000)) { $container->getDefinition('debug.file_link_formatter') ->replaceArgument(3, new ServiceClosureArgument(new Reference('debug.file_link_formatter.url_format'))); } From c82c2f1efac482a7625f87feb9ab641892184c9d Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 4 Apr 2018 11:05:00 +0200 Subject: [PATCH 09/19] [SecurityBundle] Add test for simple authentication config --- .../DependencyInjection/CompleteConfigurationTest.php | 7 +++++++ .../Tests/DependencyInjection/Fixtures/php/container1.php | 5 +++++ .../Tests/DependencyInjection/Fixtures/xml/container1.xml | 5 +++++ .../Tests/DependencyInjection/Fixtures/yml/container1.yml | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 0c4c78a1383fe..5a504dd2eaf01 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -101,6 +101,13 @@ public function testFirewalls() 'security.authentication.listener.anonymous.with_user_checker', 'security.access_listener', ), + array( + 'security.channel_listener', + 'security.context_listener.2', + 'security.authentication.listener.simple_form.simple_auth', + 'security.authentication.listener.anonymous.simple_auth', + 'security.access_listener', + ), ), $listeners); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php index fc9b07c4f18b2..54ac7b20c47f5 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php @@ -86,6 +86,11 @@ 'anonymous' => true, 'http_basic' => true, ), + 'simple_auth' => array( + 'provider' => 'default', + 'anonymous' => true, + 'simple_form' => array('authenticator' => 'simple_authenticator'), + ), ), 'access_control' => array( diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml index 19167551025e2..1e48c428000ec 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml @@ -71,6 +71,11 @@ app.user_checker + + + + + ROLE_USER ROLE_USER,ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH ROLE_USER,ROLE_ADMIN diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml index e8ed61ef031b9..46dd08f8ce948 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml @@ -70,6 +70,11 @@ security: http_basic: ~ user_checker: app.user_checker + simple_auth: + provider: default + anonymous: ~ + simple_form: { authenticator: simple_authenticator } + role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] From c318306b446c64c7fa5b9097129b3cdb1355e0c5 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 4 Apr 2018 09:58:50 +0200 Subject: [PATCH 10/19] [Security] Load the user before pre/post auth checks when needed --- .../Provider/SimpleAuthenticationProvider.php | 21 ++++++++ .../SimpleAuthenticationProviderTest.php | 49 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php index a82fb7eea4279..ded0e94f50f6c 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php @@ -11,8 +11,11 @@ namespace Symfony\Component\Security\Core\Authentication\Provider; +use Symfony\Component\Security\Core\Exception\AuthenticationServiceException; +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserChecker; use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface; @@ -45,6 +48,24 @@ public function authenticate(TokenInterface $token) } $user = $authToken->getUser(); + + if (!$user instanceof UserInterface) { + try { + $user = $this->userProvider->loadUserByUsername($user); + + if (!$user instanceof UserInterface) { + throw new AuthenticationServiceException('The user provider must return a UserInterface object.'); + } + } catch (UsernameNotFoundException $e) { + $e->setUsername($user); + throw $e; + } catch (\Exception $e) { + $e = new AuthenticationServiceException($e->getMessage(), 0, $e); + $e->setToken($token); + throw $e; + } + } + $this->userChecker->checkPreAuth($user); $this->userChecker->checkPostAuth($user); diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php index 1e7069c1fa0bb..acee33b856b42 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php @@ -15,6 +15,7 @@ use Symfony\Component\Security\Core\Exception\DisabledException; use Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider; use Symfony\Component\Security\Core\Exception\LockedException; +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; class SimpleAuthenticationProviderTest extends TestCase { @@ -72,6 +73,54 @@ public function testAuthenticateWhenPostChecksFails() $provider->authenticate($token); } + public function testAuthenticateFromString() + { + $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); + + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); + $token->expects($this->any()) + ->method('getUser') + ->will($this->returnValue('foo')); + + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); + $authenticator->expects($this->once()) + ->method('authenticateToken') + ->will($this->returnValue($token)); + + $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); + $userProvider->expects($this->once()) + ->method('loadUserByUsername') + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()); + $provider = $this->getProvider($authenticator, $userProvider); + + $this->assertSame($token, $provider->authenticate($token)); + } + + /** + * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException + */ + public function testUsernameNotFound() + { + $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); + + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); + $token->expects($this->any()) + ->method('getUser') + ->will($this->returnValue('foo')); + + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); + $authenticator->expects($this->once()) + ->method('authenticateToken') + ->will($this->returnValue($token)); + + $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); + $userProvider->expects($this->once()) + ->method('loadUserByUsername') + ->willThrowException(new UsernameNotFoundException()); + + $this->getProvider($authenticator, $userProvider)->authenticate($token); + } + protected function getProvider($simpleAuthenticator = null, $userProvider = null, $userChecker = null, $key = 'test') { if (null === $userChecker) { From 73269cfd0ebc61dfa49b1c8654bfa270f29766bb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 4 Apr 2018 15:19:51 +0200 Subject: [PATCH 11/19] [Routing] Fix throwing NoConfigurationException instead of 405 --- .../Routing/Matcher/Dumper/PhpMatcherDumper.php | 4 ++-- .../Component/Routing/Matcher/UrlMatcher.php | 2 +- .../Tests/Fixtures/dumper/url_matcher0.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 2 +- .../Tests/Fixtures/dumper/url_matcher2.php | 2 +- .../Tests/Fixtures/dumper/url_matcher3.php | 2 +- .../Tests/Fixtures/dumper/url_matcher4.php | 2 +- .../Tests/Fixtures/dumper/url_matcher5.php | 2 +- .../Tests/Fixtures/dumper/url_matcher6.php | 2 +- .../Tests/Fixtures/dumper/url_matcher7.php | 2 +- .../Routing/Tests/Matcher/UrlMatcherTest.php | 15 +++++++++++++++ 11 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index d3c931dd3fd29..40d8df67ed6e1 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -154,7 +154,7 @@ private function compileRoutes(RouteCollection $routes, $supportsRedirections) } // used to display the Welcome Page in apps that don't define a homepage - $code .= " if ('/' === \$pathinfo) {\n"; + $code .= " if ('/' === \$pathinfo && !\$allow) {\n"; $code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n"; $code .= " }\n"; @@ -362,7 +362,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren EOF; } } elseif ($methods) { - $code .= <<allow) { throw new NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php index 59253f0749da7..9e9b9103bf77e 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher0.php @@ -28,7 +28,7 @@ public function match($rawPathinfo) $canonicalMethod = 'GET'; } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 4ea0757e714fb..23a93c193423d 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -309,7 +309,7 @@ public function match($rawPathinfo) } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index 8d1c27d7c1441..e430adb1fba6c 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -371,7 +371,7 @@ public function match($rawPathinfo) } not_nonsecure: - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php index 375b56cafa4c5..67c4667467e6f 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -46,7 +46,7 @@ public function match($rawPathinfo) return array('_route' => 'with-condition'); } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php index c3ca977544ff1..ed07194a260ec 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php @@ -103,7 +103,7 @@ public function match($rawPathinfo) } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php index 3a6faea20bc47..2b22513a6179d 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php @@ -200,7 +200,7 @@ public function match($rawPathinfo) } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php index 415c328d33c4b..48ecdf81c001d 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php @@ -204,7 +204,7 @@ public function match($rawPathinfo) } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php index bbf6cf6e0bcd8..81d76ea4a047a 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php @@ -240,7 +240,7 @@ public function match($rawPathinfo) } - if ('/' === $pathinfo) { + if ('/' === $pathinfo && !$allow) { throw new Symfony\Component\Routing\Exception\NoConfigurationException(); } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index 1bd75fa339c21..e8d31e2225298 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -45,6 +45,21 @@ public function testMethodNotAllowed() } } + public function testMethodNotAllowedOnRoot() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/', array(), array(), array(), '', array(), array('GET'))); + + $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'POST')); + + try { + $matcher->match('/'); + $this->fail(); + } catch (MethodNotAllowedException $e) { + $this->assertEquals(array('GET'), $e->getAllowedMethods()); + } + } + public function testHeadAllowedWhenRequirementContainsGet() { $coll = new RouteCollection(); From f40f181167d147efd52ba118cd090043803b5b19 Mon Sep 17 00:00:00 2001 From: cvilleger Date: Wed, 4 Apr 2018 15:03:04 +0200 Subject: [PATCH 12/19] [PhpUnitBridge] Catch deprecation error handler --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index e14d218708c77..22992da68051e 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -118,7 +118,7 @@ public static function register($mode = 0) } if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) { - if (isset($trace[$i]['class']) && in_array($trace[$i]['class'], array('Symfony\Bridge\PhpUnit\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'), true)) { + if (isset($trace[$i]['class']) && 0 === strpos($trace[$i]['class'], 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor')) { $parsedMsg = unserialize($msg); $msg = $parsedMsg['deprecation']; $class = $parsedMsg['class']; @@ -216,7 +216,7 @@ public static function register($mode = 0) $groups = array('unsilenced', 'remaining'); if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode) { - $groups[] = 'remaining vendor'; + $groups[] = 'remaining vendor'; } array_push($groups, 'legacy', 'other'); From c0a051d46dac50f30b7b707d8faf5352db3c1253 Mon Sep 17 00:00:00 2001 From: Zan Baldwin Date: Wed, 4 Apr 2018 16:36:22 +0100 Subject: [PATCH 13/19] Fix Typo in Guard Factory --- .../Security/Factory/GuardAuthenticationFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php index 9ff906ad91ba7..533560d6d986d 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php @@ -116,7 +116,7 @@ private function determineEntryPoint($defaultEntryPointId, array $config) // we have multiple entry points - we must ask them to configure one throw new \LogicException(sprintf( - 'Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of you configurators (%s)', + 'Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)', implode(', ', $authenticatorIds) )); } From d0ea26bd15548b2cd4ae2f3fa46a178dc9f63a52 Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Tue, 3 Apr 2018 20:52:56 +0200 Subject: [PATCH 14/19] Update da translations --- .../Resources/translations/validators.da.xlf | 4 +- .../Resources/translations/security.da.xlf | 4 +- .../Resources/translations/security.da.xlf | 4 +- .../Resources/translations/validators.da.xlf | 50 +++++++++---------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.da.xlf b/src/Symfony/Component/Form/Resources/translations/validators.da.xlf index c2dd4601f9089..f52f4e0a30db9 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.da.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.da.xlf @@ -8,11 +8,11 @@ The uploaded file was too large. Please try to upload a smaller file. - Den oploadede fil var for stor. Opload venligst en mindre fil. + Den uploadede fil var for stor. Upload venligst en mindre fil. The CSRF token is invalid. Please try to resubmit the form. - CSRF nøglen er ugyldig. + CSRF-token er ugyldig. diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.da.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.da.xlf index 2ac41502d2c7f..a62a5eb75b084 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.da.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.da.xlf @@ -24,11 +24,11 @@ Not privileged to request the resource. - Ingen tilladselese at anvende kilden. + Ingen adgang til at forespørge ressourcen. Invalid CSRF token. - Ugyldigt CSRF token. + Ugyldig CSRF-token. Digest nonce has expired. diff --git a/src/Symfony/Component/Security/Resources/translations/security.da.xlf b/src/Symfony/Component/Security/Resources/translations/security.da.xlf index 2ac41502d2c7f..a62a5eb75b084 100644 --- a/src/Symfony/Component/Security/Resources/translations/security.da.xlf +++ b/src/Symfony/Component/Security/Resources/translations/security.da.xlf @@ -24,11 +24,11 @@ Not privileged to request the resource. - Ingen tilladselese at anvende kilden. + Ingen adgang til at forespørge ressourcen. Invalid CSRF token. - Ugyldigt CSRF token. + Ugyldig CSRF-token. Digest nonce has expired. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf index 14e479a59ad07..1630b50b45af3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf @@ -20,19 +20,19 @@ The value you selected is not a valid choice. - Værdien skal være en af de givne muligheder. + Den valgte værdi er ikke gyldig. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Du skal vælge mindst {{ limit }} muligheder. + Du skal vælge mindst én mulighed.|Du skal vælge mindst {{ limit }} muligheder. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Du kan højest vælge {{ limit }} muligheder. + Du kan højst vælge én mulighed.|Du kan højst vælge {{ limit }} muligheder. One or more of the given values is invalid. - En eller flere af de oplyste værdier er ugyldige. + En eller flere af de angivne værdier er ugyldige. This field was not expected. @@ -40,7 +40,7 @@ This field is missing. - Dette felt er mangler. + Dette felt mangler. This value is not a valid date. @@ -48,11 +48,11 @@ This value is not a valid datetime. - Værdien er ikke en gyldig dato og tid. + Værdien er ikke et gyldigt tidspunkt. This value is not a valid email address. - Værdien er ikke en gyldig e-mail adresse. + Værdien er ikke en gyldig e-mailadresse. The file could not be found. @@ -64,11 +64,11 @@ The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Filen er for stor ({{ size }} {{ suffix }}). Tilladte maksimale størrelse {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Maksimale tilladte størrelse er {{ limit }} {{ suffix }}. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Mimetypen af filen er ugyldig ({{ type }}). Tilladte mimetyper er {{ types }}. + Filens MIME-type er ugyldig ({{ type }}). Tilladte MIME-typer er {{ types }}. This value should be {{ limit }} or less. @@ -76,7 +76,7 @@ This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - Værdien er for lang. Den skal have {{ limit }} bogstaver eller mindre. + Værdien er for lang. Den må højst indeholde {{ limit }} tegn. This value should be {{ limit }} or more. @@ -84,7 +84,7 @@ This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - Værdien er for kort. Den skal have {{ limit }} tegn eller flere. + Værdien er for kort. Den skal indeholde mindst {{ limit }} tegn. This value should not be blank. @@ -104,7 +104,7 @@ This value is not a valid time. - Værdien er ikke en gyldig tid. + Værdien er ikke et gyldigt klokkeslæt. This value is not a valid URL. @@ -136,7 +136,7 @@ This is not a valid IP address. - Dette er ikke en gyldig IP adresse. + Dette er ikke en gyldig IP-adresse. This value is not a valid language. @@ -160,31 +160,31 @@ The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - Billedbredden er for stor ({{ width }}px). Tilladt maksimumsbredde er {{ max_width }}px. + Billedet er for bredt ({{ width }}px). Største tilladte bredde er {{ max_width }}px. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - Billedebredden er for lille ({{ width }}px). Forventet minimumshøjde er {{ min_width }}px. + Billedet er for smalt ({{ width }}px). Mindste forventede bredde er {{ min_width }}px. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Billedhøjden er for stor ({{ height }}px). Tilladt maksimumshøjde er {{ max_height }}px. + Billedet er for højt ({{ height }}px). Største tilladte højde er {{ max_height }}px. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - Billedhøjden er for lille ({{ height }}px). Forventet minimumshøjde er {{ min_height }}px. + Billedet er for lavt ({{ height }}px). Mindste forventede højde er {{ min_height }}px. This value should be the user's current password. - Værdien skal være brugerens nuværende password. + Værdien skal være brugerens nuværende adgangskode. This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. - Værdien skal have præcis {{ limit }} tegn. + Værdien skal være på præcis {{ limit }} tegn. The file was only partially uploaded. - Filen var kun delvis uploadet. + Filen blev kun delvist uploadet. No file was uploaded. @@ -200,19 +200,19 @@ A PHP extension caused the upload to fail. - En PHP udvidelse forårsagede fejl i upload. + En PHP-udvidelse forårsagede fejl i upload. This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - Denne samling skal indeholde {{ limit }} element eller flere.|Denne samling skal indeholde {{ limit }} elementer eller flere. + Denne samling skal indeholde mindst ét element.|Denne samling skal indeholde mindst {{ limit }} elementer. This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - Denne samling skal indeholde {{ limit }} element eller mindre.|Denne samling skal indeholde {{ limit }} elementer eller mindre. + Denne samling skal indeholde højst ét element.|Denne samling skal indeholde højst {{ limit }} elementer. This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - Denne samling skal indeholde præcis {{ limit }} element.|Denne samling skal indeholde præcis {{ limit }} elementer. + Denne samling skal indeholde præcis ét element.|Denne samling skal indeholde præcis {{ limit }} elementer. Invalid card number. @@ -224,7 +224,7 @@ This is not a valid International Bank Account Number (IBAN). - Det er ikke en gyldig International Bank Account Number (IBAN). + Det er ikke et gyldigt International Bank Account Number (IBAN). This value is not a valid ISBN-10. From 3a55a86609391f539cd28d5fd1f62e63adabb679 Mon Sep 17 00:00:00 2001 From: David Maicher Date: Wed, 4 Apr 2018 19:20:26 +0200 Subject: [PATCH 15/19] [Security] register custom providers on ExpressionLanguage directly --- .../AddExpressionLanguageProvidersPass.php | 6 ++-- ...AddExpressionLanguageProvidersPassTest.php | 28 ++++++++----------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php index d4103d8dff1a1..bceacd21ea91b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php @@ -36,10 +36,10 @@ public function process(ContainerBuilder $container) } // security - if ($container->has('security.access.expression_voter')) { - $definition = $container->findDefinition('security.access.expression_voter'); + if ($container->has('security.expression_language')) { + $definition = $container->findDefinition('security.expression_language'); foreach ($container->findTaggedServiceIds('security.expression_language_provider', true) as $id => $attributes) { - $definition->addMethodCall('addExpressionLanguageProvider', array(new Reference($id))); + $definition->addMethodCall('registerProvider', array(new Reference($id))); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddExpressionLanguageProvidersPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddExpressionLanguageProvidersPassTest.php index d2fa0f4bdfb69..89ba5ff73076a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddExpressionLanguageProvidersPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddExpressionLanguageProvidersPassTest.php @@ -24,7 +24,7 @@ public function testProcessForRouter() $container = new ContainerBuilder(); $container->addCompilerPass(new AddExpressionLanguageProvidersPass()); - $definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider'); + $definition = new Definition('\stdClass'); $definition->addTag('routing.expression_language_provider'); $container->setDefinition('some_routing_provider', $definition->setPublic(true)); @@ -43,7 +43,7 @@ public function testProcessForRouterAlias() $container = new ContainerBuilder(); $container->addCompilerPass(new AddExpressionLanguageProvidersPass()); - $definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider'); + $definition = new Definition('\stdClass'); $definition->addTag('routing.expression_language_provider'); $container->setDefinition('some_routing_provider', $definition->setPublic(true)); @@ -63,17 +63,16 @@ public function testProcessForSecurity() $container = new ContainerBuilder(); $container->addCompilerPass(new AddExpressionLanguageProvidersPass()); - $definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider'); + $definition = new Definition('\stdClass'); $definition->addTag('security.expression_language_provider'); $container->setDefinition('some_security_provider', $definition->setPublic(true)); - $container->register('security.access.expression_voter', '\stdClass')->setPublic(true); + $container->register('security.expression_language', '\stdClass')->setPublic(true); $container->compile(); - $router = $container->getDefinition('security.access.expression_voter'); - $calls = $router->getMethodCalls(); + $calls = $container->getDefinition('security.expression_language')->getMethodCalls(); $this->assertCount(1, $calls); - $this->assertEquals('addExpressionLanguageProvider', $calls[0][0]); + $this->assertEquals('registerProvider', $calls[0][0]); $this->assertEquals(new Reference('some_security_provider'), $calls[0][1][0]); } @@ -82,22 +81,17 @@ public function testProcessForSecurityAlias() $container = new ContainerBuilder(); $container->addCompilerPass(new AddExpressionLanguageProvidersPass()); - $definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider'); + $definition = new Definition('\stdClass'); $definition->addTag('security.expression_language_provider'); $container->setDefinition('some_security_provider', $definition->setPublic(true)); - $container->register('my_security.access.expression_voter', '\stdClass')->setPublic(true); - $container->setAlias('security.access.expression_voter', 'my_security.access.expression_voter'); + $container->register('my_security.expression_language', '\stdClass')->setPublic(true); + $container->setAlias('security.expression_language', 'my_security.expression_language'); $container->compile(); - $router = $container->getDefinition('my_security.access.expression_voter'); - $calls = $router->getMethodCalls(); + $calls = $container->getDefinition('my_security.expression_language')->getMethodCalls(); $this->assertCount(1, $calls); - $this->assertEquals('addExpressionLanguageProvider', $calls[0][0]); + $this->assertEquals('registerProvider', $calls[0][0]); $this->assertEquals(new Reference('some_security_provider'), $calls[0][1][0]); } } - -class TestProvider -{ -} From 24c460afa6499f5a5a800c5ed34468d3f574f7af Mon Sep 17 00:00:00 2001 From: Peter Orosz Date: Thu, 5 Apr 2018 16:08:40 +0200 Subject: [PATCH 16/19] [EventDispatcher] Dispatcher in stopEventPropagation test now registers correct listener --- .../EventDispatcher/Tests/AbstractEventDispatcherTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php index e5e9c2be83b43..5c82435d58a06 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php @@ -154,7 +154,7 @@ public function testStopEventPropagation() // be executed // Manually set priority to enforce $this->listener to be called first $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10); - $this->dispatcher->addListener('post.foo', array($otherListener, 'preFoo')); + $this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo')); $this->dispatcher->dispatch(self::postFoo); $this->assertTrue($this->listener->postFooInvoked); $this->assertFalse($otherListener->postFooInvoked); From 97d2fbbe97f598240682140265ab5ca07d1c28e1 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Thu, 5 Apr 2018 18:37:47 -0400 Subject: [PATCH 17/19] [Form] Fix typo in Upgrade 3.4/4.0 --- UPGRADE-3.4.md | 2 +- UPGRADE-4.0.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 38891caf76944..765e5cf467637 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -124,7 +124,7 @@ Form ```php class MyTimezoneType extends TimezoneType { - public function loadChoices() + public function loadChoiceList() { // override the method } diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 4a6d02b37440b..14dc6f07a6f8d 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -368,7 +368,7 @@ Form ```php class MyTimezoneType extends TimezoneType { - public function loadChoices() + public function loadChoiceList() { // override the method } From 0cbee5e9aa1ef7c5d6582e4370596a6e63a20fc8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 6 Apr 2018 17:19:35 +0200 Subject: [PATCH 18/19] updated CHANGELOG for 3.4.8 --- CHANGELOG-3.4.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index ee69e43fc8382..abc5e0a9f4da1 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,16 @@ in 3.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.4.0...v3.4.1 +* 3.4.8 (2018-04-06) + + * bug #26802 [Security] register custom providers on ExpressionLanguage directly (dmaicher) + * bug #26794 [PhpUnitBridge] Catch deprecation error handler (cvilleger) + * bug #26788 [Security] Load the user before pre/post auth checks when needed (chalasr) + * bug #26792 [Routing] Fix throwing NoConfigurationException instead of 405 (nicolas-grekas) + * bug #26774 [SecurityBundle] Add missing argument to security.authentication.provider.simple (i3or1s, chalasr) + * bug #26763 [Finder] Remove duplicate slashes in filenames (helhum) + * bug #26758 [WebProfilerBundle][HttpKernel] Make FileLinkFormatter URL format generation lazy (nicolas-grekas) + * 3.4.7 (2018-04-03) * bug #26387 [Yaml] Fix regression when trying to parse multiline (antograssiot) From 884b994be98571ead1f30fa86a5aabd89f3c6ec1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 6 Apr 2018 17:19:48 +0200 Subject: [PATCH 19/19] updated VERSION for 3.4.8 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 7cb3621744d3e..03cd708ebf241 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.8-DEV'; + const VERSION = '3.4.8'; const VERSION_ID = 30408; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; const RELEASE_VERSION = 8; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021';