From 43c7f9b5e95cd2b330f489eab08e8f43a32285da Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 25 Apr 2016 16:50:46 +0100 Subject: [PATCH 01/79] [Routing] Fix the annotation loader taking a class constant as a beginning of a class name --- .../Routing/Loader/AnnotationFileLoader.php | 2 ++ .../Tests/Fixtures/AnnotatedClasses/FooTrait.php | 13 +++++++++++++ .../Tests/Loader/AnnotationFileLoaderTest.php | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index a3a7e0e5ae50e..7e424fd336c5c 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -96,6 +96,8 @@ protected function findClass($file) $token = $tokens[$i]; if (!isset($token[1])) { + $class = false; + continue; } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php new file mode 100644 index 0000000000000..f34c6b64cf431 --- /dev/null +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php @@ -0,0 +1,13 @@ +loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); } + /** + * @requires PHP 5.4 + */ + public function testLoadTraitWithClassConstant() + { + $this->reader->expects($this->never())->method('getClassAnnotation'); + + $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooTrait.php'); + } + /** * @requires PHP 5.6 */ From 9b35449216a6f66188f9b17851ee57fe86c82e18 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Mon, 2 May 2016 12:14:36 +0100 Subject: [PATCH 02/79] [console][table] adjust width of colspanned cell. --- .../Component/Console/Helper/Table.php | 16 ++++-- .../Console/Tests/Helper/TableTest.php | 56 ++++++++++--------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 3823e9c4f61ca..f0445e118d585 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -521,6 +521,18 @@ private function getColumnWidth($column) continue; } + foreach ($row as $i => $cell) { + if ($cell instanceof TableCell) { + $textLength = strlen($cell); + if ($textLength > 0) { + $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan())); + foreach ($contentColumns as $position => $content) { + $row[$i + $position] = $content; + } + } + } + } + $lengths[] = $this->getCellWidth($row, $column); } @@ -550,10 +562,6 @@ private function getCellWidth(array $row, $column) if (isset($row[$column])) { $cell = $row[$column]; $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); - if ($cell instanceof TableCell && $cell->getColspan() > 1) { - // we assume that cell value will be across more than one column. - $cellWidth = $cellWidth / $cell->getColspan(); - } return $cellWidth; } diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index ab562fdb57708..c933ff6a69760 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -269,21 +269,27 @@ public function testRenderProvider() '9971-5-0210-0', new TableCell("A Tale of \nTwo Cities", array('colspan' => 2)), ), + new TableSeparator(), + array( + new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', array('colspan' => 3)), + ), ), 'default', << Date: Mon, 9 May 2016 14:45:08 -0500 Subject: [PATCH 03/79] updated CHANGELOG for 2.3.41 --- CHANGELOG-2.3.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index d0ca6221aca02..1d8ff9479ecca 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,11 @@ in 2.3 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/v2.3.0...v2.3.1 +* 2.3.41 (2016-05-09) + + * security #18733 limited the maximum length of a submitted username (fabpot) + * bug #18709 [DependencyInjection] top-level anonymous services must be public (xabbuh) + * 2.3.40 (2016-04-29) * bug #18246 [DependencyInjection] fix ambiguous services schema (backbone87) From f80f5882183c61fd56a5269bbf7c07b6bd8b658b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 14:45:18 -0500 Subject: [PATCH 04/79] update CONTRIBUTORS for 2.3.41 --- CONTRIBUTORS.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 456aeba37aa74..d8e08d87119b7 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -40,9 +40,9 @@ Symfony is the result of the work of many people who made the code better - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar + - Jules Pietri (heah) - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - - Jules Pietri (heah) - Francis Besset (francisbesset) - Bulat Shakirzyanov (avalanche123) - Saša Stamenković (umpirsky) @@ -129,6 +129,7 @@ Symfony is the result of the work of many people who made the code better - Arnaud Kleinpeter (nanocom) - Joel Wurtz (brouznouf) - Philipp Wahala (hifi) + - Titouan Galopin (tgalopin) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Vincent AUBERT (vincent) @@ -141,7 +142,6 @@ Symfony is the result of the work of many people who made the code better - Michał Pipa (michal.pipa) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - - Titouan Galopin (tgalopin) - Artur Kotyrba - Rouven Weßling (realityking) - Warnar Boekkooi (boekkooi) @@ -240,6 +240,7 @@ Symfony is the result of the work of many people who made the code better - Michael Holm (hollo) - Marc Weistroff (futurecat) - Hidde Wieringa (hiddewie) + - Daniel Espendiller - Chris Smith (cs278) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) @@ -436,6 +437,7 @@ Symfony is the result of the work of many people who made the code better - Benjamin Leveque (benji07) - Nate (frickenate) - jhonnyL + - Jhonny Lidfors (jhonne) - sasezaki - Dawid Pakuła (zulusx) - Florian Rey (nervo) @@ -611,7 +613,6 @@ Symfony is the result of the work of many people who made the code better - Adrien Lucas (adrienlucas) - James Michael DuPont - Tom Klingenberg - - Jhonny Lidfors (jhonne) - Christopher Hall (mythmakr) - Paul Kamer (pkamer) - Rafał Wrzeszcz (rafalwrzeszcz) @@ -904,7 +905,6 @@ Symfony is the result of the work of many people who made the code better - Albin Kerouaton - Sébastien HOUZÉ - Jingyu Wang - - Daniel Espendiller - steveYeah - Samy Dindane (dinduks) - Keri Henare (kerihenare) @@ -945,6 +945,7 @@ Symfony is the result of the work of many people who made the code better - Tadcka - Beth Binkovitz - Romain Geissler + - Oliver Hoff - Tomaz Ahlin - Benjamin Cremer (bcremer) - Marcus Stöhr (dafish) @@ -1302,6 +1303,7 @@ Symfony is the result of the work of many people who made the code better - znerol - Christian Eikermann - Antonio Angelino + - Shawn Iwinski - Vladimir Sazhin - lol768 - jamogon From efd48596a98261fdb7f27d693b80ab80445580b9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 14:45:27 -0500 Subject: [PATCH 05/79] updated VERSION for 2.3.41 --- 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 71cc0a60de511..8c1854a18e41f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.41-DEV'; + const VERSION = '2.3.41'; const VERSION_ID = 20341; const MAJOR_VERSION = 2; const MINOR_VERSION = 3; const RELEASE_VERSION = 41; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From c7d3b4584170db75011b48698734132af2978edc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 9 May 2016 14:43:14 -0500 Subject: [PATCH 06/79] [Debug] Fix fatal error handlers on PHP 7 --- src/Symfony/Component/Debug/ErrorHandler.php | 8 ++++---- .../Debug/Exception/FatalThrowableError.php | 2 +- .../Component/Debug/Tests/ErrorHandlerTest.php | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index c3cae81bde0d9..33779af3251e7 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -469,7 +469,7 @@ public function handleException($exception, array $error = null) } $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; - if ($this->loggedErrors & $type) { + if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { $e = array( 'type' => $type, 'file' => $exception->getFile(), @@ -496,9 +496,9 @@ public function handleException($exception, array $error = null) } else { $message = 'Uncaught Exception: '.$exception->getMessage(); } - if ($this->loggedErrors & $e['type']) { - $this->loggers[$e['type']][0]->log($this->loggers[$e['type']][1], $message, $e); - } + } + if ($this->loggedErrors & $type) { + $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e); } if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) { foreach ($this->getFatalErrorHandlers() as $handler) { diff --git a/src/Symfony/Component/Debug/Exception/FatalThrowableError.php b/src/Symfony/Component/Debug/Exception/FatalThrowableError.php index 6ff5ecdaffed0..34f43b17b13b4 100644 --- a/src/Symfony/Component/Debug/Exception/FatalThrowableError.php +++ b/src/Symfony/Component/Debug/Exception/FatalThrowableError.php @@ -27,7 +27,7 @@ public function __construct(\Throwable $e) $message = 'Type error: '.$e->getMessage(); $severity = E_RECOVERABLE_ERROR; } else { - $message = 'Fatal error: '.$e->getMessage(); + $message = $e->getMessage(); $severity = E_ERROR; } diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index c107c0c7cb56b..12f2fcb40bc8d 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -413,6 +413,24 @@ public function testHandleFatalError() } } + /** + * @requires PHP 7 + */ + public function testHandleErrorException() + { + $exception = new \Error("Class 'Foo' not found"); + + $handler = new ErrorHandler(); + $handler->setExceptionHandler(function () use (&$args) { + $args = func_get_args(); + }); + + $handler->handleException($exception); + + $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]); + $this->assertSame("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement?", $args[0]->getMessage()); + } + public function testHandleFatalErrorOnHHVM() { try { From 45332209976eb1aa0ae729aeaf681a875f6732f3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 15:32:07 -0500 Subject: [PATCH 07/79] bumped Symfony version to 2.3.42 --- 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 8c1854a18e41f..85df657668bff 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.41'; - const VERSION_ID = 20341; + const VERSION = '2.3.42-DEV'; + const VERSION_ID = 20342; const MAJOR_VERSION = 2; const MINOR_VERSION = 3; - const RELEASE_VERSION = 41; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 42; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From f31a08d69c284d6ae71065bd49d904dbded49298 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 15:35:20 -0500 Subject: [PATCH 08/79] updated CHANGELOG for 2.7.13 --- CHANGELOG-2.7.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index 89ee3b549f479..cfe286f2a4caf 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,14 @@ in 2.7 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/v2.7.0...v2.7.1 +* 2.7.13 (2016-05-09) + + * security #18733 limited the maximum length of a submitted username (fabpot) + * bug #18730 [FrameworkBundle] prevent calling get() for service_container service (xabbuh) + * bug #18709 [DependencyInjection] top-level anonymous services must be public (xabbuh) + * bug #18692 add @Event annotation for KernelEvents (Haehnchen) + * bug #18246 [DependencyInjection] fix ambiguous services schema (backbone87) + * 2.7.12 (2016-04-29) * bug #18180 [Form] fixed BC break with pre selection of choices with `ChoiceType` and its children (HeahDude) From d0c233ee4d9fd3c962dd3cdb9de65f967f50effd Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 15:35:33 -0500 Subject: [PATCH 09/79] updated VERSION for 2.7.13 --- 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 6c871d77b3e67..c348cac299911 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.13-DEV'; + const VERSION = '2.7.13'; const VERSION_ID = 20713; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 13; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From ebdff4686df7e234bf621b6a064c0d875d84d7c9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 16:42:27 -0500 Subject: [PATCH 10/79] bumped Symfony version to 2.7.14 --- 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 c348cac299911..a7240ac5c131d 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.13'; - const VERSION_ID = 20713; + const VERSION = '2.7.14-DEV'; + const VERSION_ID = 20714; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 13; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 14; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From ce1ca0255d955f62c2713bd9e3cc02bc333f1bd2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 16:45:27 -0500 Subject: [PATCH 11/79] updated CHANGELOG for 2.8.6 --- CHANGELOG-2.8.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 854716d996a75..19d984b3f5b1d 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,18 @@ in 2.8 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/v2.8.0...v2.8.1 +* 2.8.6 (2016-05-09) + + * security #18736 Fixed issue with blank password with Ldap (csarrazi) + * security #18733 limited the maximum length of a submitted username (fabpot) + * bug #18730 [FrameworkBundle] prevent calling get() for service_container service (xabbuh) + * bug #18705 added a conflict between Monolog bridge 2.8 and HTTP Kernel 3.0+ (fabpot) + * bug #18709 [DependencyInjection] top-level anonymous services must be public (xabbuh) + * bug #18388 [EventDispatcher] check for method to exist (xabbuh) + * bug #18699 [DependencyInjection] Use the priority of service decoration on service with parent (hason) + * bug #18692 add @Event annotation for KernelEvents (Haehnchen) + * bug #18246 [DependencyInjection] fix ambiguous services schema (backbone87) + * 2.8.5 (2016-04-29) * bug #18180 [Form] fixed BC break with pre selection of choices with `ChoiceType` and its children (HeahDude) From 6d3b1e22c49119a0ba8038e6be66a7da71a70d5b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 16:45:36 -0500 Subject: [PATCH 12/79] updated VERSION for 2.8.6 --- 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 f949701322af0..a95bd97ee3a21 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.6-DEV'; + const VERSION = '2.8.6'; const VERSION_ID = 20806; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 6; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From e9ea57f6c7998383352fdb1891337f6627d72cd6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 17:09:16 -0500 Subject: [PATCH 13/79] bumped Symfony version to 2.8.7 --- 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 a95bd97ee3a21..a79a0fba0bd4f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.6'; - const VERSION_ID = 20806; + const VERSION = '2.8.7-DEV'; + const VERSION_ID = 20807; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 6; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 7; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 74a3d0b9c29f0fbd0e7dced9135758c2bb6f52d9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2016 17:35:04 -0500 Subject: [PATCH 14/79] bumped Symfony version to 3.0.7 --- 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 8dde0e1d8ed3e..3624faf07b183 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '3.0.6'; - const VERSION_ID = 30006; + const VERSION = '3.0.7-DEV'; + const VERSION_ID = 30007; const MAJOR_VERSION = 3; const MINOR_VERSION = 0; - const RELEASE_VERSION = 6; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 7; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2016'; const END_OF_LIFE = '01/2017'; From 72c44c274eb781fc3518562d65fff7433ab4ce93 Mon Sep 17 00:00:00 2001 From: Daniel Beyer Date: Wed, 11 May 2016 10:46:10 +0200 Subject: [PATCH 15/79] [MonologBridge] Uninstallable together with symfony/http-kernel in 3.0.6 Caused by #18705, it is impossible to install v3.0.6 of symfony/monolog-bridge together with v3.0.6 of symfony/http-kernel. The intention of #18705 "added a conflict between Monolog bridge 2.8 and HTTP Kernel 3.0+" was to prevent installing symfony/monolog-bridge from the 3.0 series with http-kernel from the 2.8 series of symfony. While this now works correctly in v2.8.6, it breaks installing symfony/monolog-bridge v3.0.6 with symfony/http-kernel v3.0.6. This commit resolves this issue. --- src/Symfony/Bridge/Monolog/composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index 6d94761630a26..9e943ad2e640f 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -24,9 +24,6 @@ "symfony/console": "~2.8|~3.0", "symfony/event-dispatcher": "~2.8|~3.0" }, - "conflict": { - "symfony/http-kernel": ">=3.0" - }, "suggest": { "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.", From 9a0bc995bbcf348c64c859fcceaa0ed17f10f07e Mon Sep 17 00:00:00 2001 From: Francis Besset Date: Wed, 11 May 2016 15:21:50 +0200 Subject: [PATCH 16/79] Fixed DateTimeInterface comparaison Fixed DateTimeInterface comparaison --- .../Core/DataTransformer/DateTimeToArrayTransformer.php | 4 ++-- .../DataTransformer/DateTimeToLocalizedStringTransformer.php | 4 ++-- .../Core/DataTransformer/DateTimeToRfc3339Transformer.php | 4 ++-- .../Core/DataTransformer/DateTimeToStringTransformer.php | 4 ++-- .../Core/DataTransformer/DateTimeToTimestampTransformer.php | 4 ++-- src/Symfony/Component/HttpFoundation/Cookie.php | 2 +- .../Component/HttpKernel/DataCollector/Util/ValueExporter.php | 2 +- src/Symfony/Component/Validator/ConstraintValidator.php | 4 ++-- .../Validator/Constraints/AbstractComparisonValidator.php | 2 +- .../Component/Validator/Constraints/RangeValidator.php | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php index 07070952f5065..614656b45d504 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php @@ -72,8 +72,8 @@ public function transform($dateTime) ), array_flip($this->fields)); } - if (!$dateTime instanceof \DateTime && !$dateTime instanceof \DateTimeInterface) { - throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); } if ($this->inputTimezone !== $this->outputTimezone) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index b38680a1bb6ec..d6467fc194ad5 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -84,8 +84,8 @@ public function transform($dateTime) return ''; } - if (!$dateTime instanceof \DateTime && !$dateTime instanceof \DateTimeInterface) { - throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); } $value = $this->getIntlDateFormatter()->format($dateTime->getTimestamp()); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php index c78d80401a385..3ebc86de7bb86 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -27,8 +27,8 @@ public function transform($dateTime) return ''; } - if (!$dateTime instanceof \DateTime && !$dateTime instanceof \DateTimeInterface) { - throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); } if ($this->inputTimezone !== $this->outputTimezone) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php index 7e2d3beece6ef..d855122b4159b 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php @@ -99,8 +99,8 @@ public function transform($value) return ''; } - if (!$value instanceof \DateTime && !$value instanceof \DateTimeInterface) { - throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + if (!$value instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); } if (!$value instanceof \DateTimeImmutable) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php index b8f5f381a5a40..031c0c3a111f1 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php @@ -38,8 +38,8 @@ public function transform($value) return; } - if (!$value instanceof \DateTime && !$value instanceof \DateTimeInterface) { - throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + if (!$value instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); } return $value->getTimestamp(); diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index 13d69f3bd2edd..29ff700fa841a 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -51,7 +51,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom } // convert expiration time to a Unix timestamp - if ($expire instanceof \DateTime || $expire instanceof \DateTimeInterface) { + if ($expire instanceof \DateTimeInterface) { $expire = $expire->format('U'); } elseif (!is_numeric($expire)) { $expire = strtotime($expire); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php index c9e51cc26ff12..b06dd83b3da39 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php @@ -28,7 +28,7 @@ class ValueExporter public function exportValue($value, $depth = 1, $deep = false) { if (is_object($value)) { - if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { + if ($value instanceof \DateTimeInterface) { return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601)); } diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php index bd69ee92a9680..ece4400065c6a 100644 --- a/src/Symfony/Component/Validator/ConstraintValidator.php +++ b/src/Symfony/Component/Validator/ConstraintValidator.php @@ -72,7 +72,7 @@ protected function formatTypeOf($value) * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped * in double quotes ("). Objects, arrays and resources are formatted as * "object", "array" and "resource". If the $format bitmask contains - * the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted + * the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted * as RFC-3339 dates ("Y-m-d H:i:s"). * * Be careful when passing message parameters to a constraint violation @@ -89,7 +89,7 @@ protected function formatTypeOf($value) */ protected function formatValue($value, $format = 0) { - $isDateTime = $value instanceof \DateTime || $value instanceof \DateTimeInterface; + $isDateTime = $value instanceof \DateTimeInterface; if (($format & self::PRETTY_DATE) && $isDateTime) { if (class_exists('IntlDateFormatter')) { diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php index 85a3f944be5d6..024e6698a57e4 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php @@ -47,7 +47,7 @@ public function validate($value, Constraint $constraint) // If $value is immutable, convert the compared value to a // DateTimeImmutable too $comparedValue = new \DatetimeImmutable($comparedValue); - } elseif ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { + } elseif ($value instanceof \DateTimeInterface) { // Otherwise use DateTime $comparedValue = new \DateTime($comparedValue); } diff --git a/src/Symfony/Component/Validator/Constraints/RangeValidator.php b/src/Symfony/Component/Validator/Constraints/RangeValidator.php index 067dd8c1f3db1..ac140dbbf34e2 100644 --- a/src/Symfony/Component/Validator/Constraints/RangeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/RangeValidator.php @@ -33,7 +33,7 @@ public function validate($value, Constraint $constraint) return; } - if (!is_numeric($value) && !$value instanceof \DateTime && !$value instanceof \DateTimeInterface) { + if (!is_numeric($value) && !$value instanceof \DateTimeInterface) { $this->context->buildViolation($constraint->invalidMessage) ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) ->setCode(Range::INVALID_CHARACTERS_ERROR) @@ -49,7 +49,7 @@ public function validate($value, Constraint $constraint) // This allows to compare with any date/time value supported by // the DateTime constructor: // http://php.net/manual/en/datetime.formats.php - if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { + if ($value instanceof \DateTimeInterface) { if (is_string($min)) { $min = new \DateTime($min); } From 8f136ab66585dc5ca933363a8f39c336a3878d9b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 11 May 2016 17:02:33 -0500 Subject: [PATCH 17/79] Drop hirak/prestissimo --- .composer/composer.json | 5 --- .composer/composer.lock | 70 ----------------------------------------- .composer/config.json | 3 -- .travis.yml | 3 +- appveyor.yml | 5 ++- 5 files changed, 3 insertions(+), 83 deletions(-) delete mode 100644 .composer/composer.json delete mode 100644 .composer/composer.lock diff --git a/.composer/composer.json b/.composer/composer.json deleted file mode 100644 index d69e9f7626d55..0000000000000 --- a/.composer/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "hirak/prestissimo": "^0.1.18" - } -} diff --git a/.composer/composer.lock b/.composer/composer.lock deleted file mode 100644 index 7027e21d9ac4b..0000000000000 --- a/.composer/composer.lock +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "e02685ff7d2409d34fa87e306fc86ec5", - "content-hash": "2854c05c76a78113c693dbbdd3f9c518", - "packages": [ - { - "name": "hirak/prestissimo", - "version": "0.1.18", - "source": { - "type": "git", - "url": "https://github.com/hirak/prestissimo.git", - "reference": "84e9fb79ec18a4428c5a0c032eacac640d89be5d" - }, - "dist": { - "type": "zip", - "url": "https://codeload.github.com/hirak/prestissimo/legacy.zip/84e9fb79ec18a4428c5a0c032eacac640d89be5d", - "reference": "84e9fb79ec18a4428c5a0c032eacac640d89be5d", - "shasum": "" - }, - "require": { - "composer-plugin-api": "~1.0.0-alpha10", - "ext-curl": "*", - "php": ">=5.3.2" - }, - "require-dev": { - "composer/composer": "1.0.0-alpha10", - "phpunit/phpunit": "^4.8", - "squizlabs/php_codesniffer": "^2.5" - }, - "type": "composer-plugin", - "extra": { - "class": "Hirak\\Prestissimo\\Plugin" - }, - "autoload": { - "psr-4": { - "Hirak\\Prestissimo\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Hiraku NAKANO", - "email": "hiraku@tojiru.net" - } - ], - "description": "composer parallel install plugin", - "keywords": [ - "install", - "parallel", - "speedup" - ], - "time": "2016-03-17 13:53:53" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/.composer/config.json b/.composer/config.json index 436403f601177..941bc3b56e8cd 100644 --- a/.composer/config.json +++ b/.composer/config.json @@ -2,9 +2,6 @@ "config": { "preferred-install": { "*": "dist" - }, - "prestissimo": { - "insecure": true } } } diff --git a/.travis.yml b/.travis.yml index 94b7482bd35d7..59e065e48d71c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,9 +51,8 @@ before_install: - if [[ ! $skip && $PHP != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi - if [[ ! $skip && $PHP != hhvm ]]; then phpenv config-rm xdebug.ini; fi - if [[ ! $skip ]]; then composer self-update --stable; fi - - if [[ ! $skip ]]; then cp .composer/* ~/.composer/; composer global install; fi + - if [[ ! $skip ]]; then cp .composer/* ~/.composer/; fi - if [[ ! $skip ]]; then ./phpunit install; fi - - if [[ ! $skip && $deps ]]; then composer global remove hirak/prestissimo; fi - if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi install: diff --git a/appveyor.yml b/appveyor.yml index 3151b22d9d184..aa992d719eea8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,7 +18,7 @@ init: install: - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php) - cd c:\php - - IF %PHP%==1 appveyor DownloadFile https://curl.haxx.se/ca/cacert.pem + - IF %PHP%==1 appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/cacert.pem - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.3.3-nts-Win32-VC9-x86.zip - IF %PHP%==1 7z x php-5.3.3-nts-Win32-VC9-x86.zip -y >nul - IF %PHP%==1 appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/ICU-51.2-dlls.zip @@ -49,12 +49,11 @@ install: - IF %PHP%==1 echo extension=php_pdo_sqlite.dll >> php.ini-max - IF %PHP%==1 echo extension=php_curl.dll >> php.ini-max - IF %PHP%==1 echo curl.cainfo=c:\php\cacert.pem >> php.ini-max - - IF %PHP%==1 appveyor DownloadFile https://getcomposer.org/download/1.0.2/composer.phar + - IF %PHP%==1 appveyor DownloadFile https://getcomposer.org/download/1.0.3/composer.phar - copy /Y php.ini-max php.ini - cd c:\projects\symfony - mkdir %APPDATA%\Composer - copy /Y .composer\* %APPDATA%\Composer\ - - composer global install --no-progress --ansi - php phpunit install - IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev) - composer update --no-progress --ansi From 09b70a1df4c7ac1ac0d4d6eb004fc1d4aaf87125 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 13 May 2016 09:29:13 +0200 Subject: [PATCH 18/79] Updated the link to the list of currency codes --- src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index 7118a03515687..d16f96ee5865c 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -308,7 +308,7 @@ public static function create($locale = 'en', $style = null, $pattern = null) * @return string The formatted currency value * * @see http://www.php.net/manual/en/numberformatter.formatcurrency.php - * @see http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm + * @see https://en.wikipedia.org/wiki/ISO_4217#Active_codes */ public function formatCurrency($value, $currency) { From 7101cab29f7ccd95eb96a0c258a11a36d05c3cb7 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 11 May 2016 01:50:58 +0900 Subject: [PATCH 19/79] [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper --- .../ViolationMapper/ViolationMapper.php | 8 ++--- .../ViolationMapper/ViolationMapperTest.php | 29 +++++++++++++++---- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php index bef225c422d5a..5cc6b65d20109 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php @@ -161,9 +161,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $ } } - $children = iterator_to_array(new \RecursiveIteratorIterator( - new InheritDataAwareIterator($form) - )); + $children = iterator_to_array(new \RecursiveIteratorIterator(new InheritDataAwareIterator($form)), false); while ($it->valid()) { if ($it->isIndex()) { @@ -188,7 +186,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $ } /** @var FormInterface $child */ - foreach ($children as $key => $child) { + foreach ($children as $i => $child) { $childPath = (string) $child->getPropertyPath(); if ($childPath === $chunk) { $target = $child; @@ -197,7 +195,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $ continue; } - unset($children[$key]); + unset($children[$i]); } $it->next(); diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index f6ad34eccb6b8..222c36bdd59ee 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -1477,22 +1477,39 @@ public function testErrorMappingForFormInheritingParentData($target, $childName, public function testBacktrackIfSeveralSubFormsWithSamePropertyPath() { - $violation = $this->getConstraintViolation('data.address[street]'); $parent = $this->getForm('parent'); $child1 = $this->getForm('subform1', 'address'); $child2 = $this->getForm('subform2', 'address'); - $grandChild = $this->getForm('street'); + $child3 = $this->getForm('subform3', null, null, array(), true); + $child4 = $this->getForm('subform4', null, null, array(), true); + $grandChild1 = $this->getForm('street'); + $grandChild2 = $this->getForm('street', '[sub_address1_street]'); + $grandChild3 = $this->getForm('street', '[sub_address2_street]'); $parent->add($child1); $parent->add($child2); - $child2->add($grandChild); + $parent->add($child3); + $parent->add($child4); + $child2->add($grandChild1); + $child3->add($grandChild2); + $child4->add($grandChild3); - $this->mapper->mapViolation($violation, $parent); + $parent->submit(array()); + + $violation1 = $this->getConstraintViolation('data.address[street]'); + $violation2 = $this->getConstraintViolation('data[sub_address1_street]'); + $violation3 = $this->getConstraintViolation('data[sub_address2_street]'); + $this->mapper->mapViolation($violation1, $parent); + $this->mapper->mapViolation($violation2, $parent); + $this->mapper->mapViolation($violation3, $parent); - // The error occurred on the child of the second form with the same path $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $child1->getErrors(), $child1->getName().' should not have an error, but has one'); $this->assertCount(0, $child2->getErrors(), $child2->getName().' should not have an error, but has one'); - $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChild->getName().' should have an error, but has none'); + $this->assertCount(0, $child3->getErrors(), $child3->getName().' should not have an error, but has one'); + $this->assertCount(0, $child4->getErrors(), $child4->getName().' should not have an error, but has one'); + $this->assertEquals(array($this->getFormError($violation1, $grandChild1)), $grandChild1->getErrors(), $grandChild1->getName().' should have an error, but has none'); + $this->assertEquals(array($this->getFormError($violation2, $grandChild2)), $grandChild2->getErrors(), $grandChild2->getName().' should have an error, but has none'); + $this->assertEquals(array($this->getFormError($violation3, $grandChild3)), $grandChild3->getErrors(), $grandChild3->getName().' should have an error, but has none'); } } From 94b9e449934084ac4bfd9ab94d2d626a2d0aad16 Mon Sep 17 00:00:00 2001 From: Daniel Espendiller Date: Fri, 6 May 2016 13:34:38 +0200 Subject: [PATCH 20/79] Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns --- src/Symfony/Component/Finder/Finder.php | 50 ++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 51b81830236e5..1b13509f6334b 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -171,7 +171,7 @@ public function getAdapters() /** * Restricts the matching to directories only. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance */ public function directories() { @@ -183,7 +183,7 @@ public function directories() /** * Restricts the matching to files only. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance */ public function files() { @@ -202,7 +202,7 @@ public function files() * * @param int $level The depth level expression * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see DepthRangeFilterIterator * @see NumberComparator @@ -226,7 +226,7 @@ public function depth($level) * * @param string $date A date range string * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see strtotime * @see DateRangeFilterIterator @@ -250,7 +250,7 @@ public function date($date) * * @param string $pattern A pattern (a regexp, a glob, or a string) * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see FilenameFilterIterator */ @@ -266,7 +266,7 @@ public function name($pattern) * * @param string $pattern A pattern (a regexp, a glob, or a string) * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see FilenameFilterIterator */ @@ -287,7 +287,7 @@ public function notName($pattern) * * @param string $pattern A pattern (string or regexp) * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see FilecontentFilterIterator */ @@ -308,7 +308,7 @@ public function contains($pattern) * * @param string $pattern A pattern (string or regexp) * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see FilecontentFilterIterator */ @@ -331,7 +331,7 @@ public function notContains($pattern) * * @param string $pattern A pattern (a regexp or a string) * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see FilenameFilterIterator */ @@ -354,7 +354,7 @@ public function path($pattern) * * @param string $pattern A pattern (a regexp or a string) * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see FilenameFilterIterator */ @@ -374,7 +374,7 @@ public function notPath($pattern) * * @param string $size A size range string * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SizeRangeFilterIterator * @see NumberComparator @@ -391,7 +391,7 @@ public function size($size) * * @param string|array $dirs A directory path or an array of directories * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see ExcludeDirectoryFilterIterator */ @@ -407,7 +407,7 @@ public function exclude($dirs) * * @param bool $ignoreDotFiles Whether to exclude "hidden" files or not * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see ExcludeDirectoryFilterIterator */ @@ -427,7 +427,7 @@ public function ignoreDotFiles($ignoreDotFiles) * * @param bool $ignoreVCS Whether to exclude VCS files or not * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see ExcludeDirectoryFilterIterator */ @@ -467,7 +467,7 @@ public static function addVCSPattern($pattern) * * @param \Closure $closure An anonymous function * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SortableIterator */ @@ -483,7 +483,7 @@ public function sort(\Closure $closure) * * This can be slow as all the matching files and directories must be retrieved for comparison. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SortableIterator */ @@ -499,7 +499,7 @@ public function sortByName() * * This can be slow as all the matching files and directories must be retrieved for comparison. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SortableIterator */ @@ -517,7 +517,7 @@ public function sortByType() * * This can be slow as all the matching files and directories must be retrieved for comparison. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SortableIterator */ @@ -537,7 +537,7 @@ public function sortByAccessedTime() * * This can be slow as all the matching files and directories must be retrieved for comparison. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SortableIterator */ @@ -555,7 +555,7 @@ public function sortByChangedTime() * * This can be slow as all the matching files and directories must be retrieved for comparison. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see SortableIterator */ @@ -574,7 +574,7 @@ public function sortByModifiedTime() * * @param \Closure $closure An anonymous function * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @see CustomFilterIterator */ @@ -588,7 +588,7 @@ public function filter(\Closure $closure) /** * Forces the following of symlinks. * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance */ public function followLinks() { @@ -604,7 +604,7 @@ public function followLinks() * * @param bool $ignore * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance */ public function ignoreUnreadableDirs($ignore = true) { @@ -618,7 +618,7 @@ public function ignoreUnreadableDirs($ignore = true) * * @param string|array $dirs A directory path or an array of directories * - * @return Finder The current Finder instance + * @return Finder|SplFileInfo[] The current Finder instance * * @throws \InvalidArgumentException if one of the directories does not exist */ @@ -679,7 +679,7 @@ public function getIterator() * * @param mixed $iterator * - * @return Finder The finder + * @return Finder|SplFileInfo[] The finder * * @throws \InvalidArgumentException When the given argument is not iterable. */ From 80300f52d485c6e77dcc675c20b2ad42838a5d86 Mon Sep 17 00:00:00 2001 From: danionut90 Date: Wed, 4 May 2016 22:31:11 +0300 Subject: [PATCH 21/79] added StaticVerionStrategyTest --- .../StaticVersionStrategyTest.php | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php new file mode 100644 index 0000000000000..77958ce2ca0cc --- /dev/null +++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Asset\Tests\VersionStrategy; + +use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy; + +class StaticVersionStrategyTest extends \PHPUnit_Framework_TestCase +{ + public function testGetVersion() + { + $version = 'v1'; + $path = 'test-path'; + $staticVersionStrategy = new StaticVersionStrategy($version); + $this->assertEquals($version, $staticVersionStrategy->getVersion($path)); + } + + /** + * @dataProvider getConfigs + */ + public function testApplyVersion($path, $version, $format) + { + $staticVersionStrategy = new StaticVersionStrategy($version, $format); + $formatted = sprintf($format ?: '%s?%s', $path, $version); + $this->assertEquals($formatted, $staticVersionStrategy->applyVersion($path)); + } + + public function getConfigs() + { + return array( + array('test-path', 'v1', null), + array('test-path', 'v2', '%s?test%s'), + ); + } +} From 31285c22fa0f60414b5723cd8918fdd5af039089 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 25 Apr 2016 19:03:00 +0200 Subject: [PATCH 22/79] [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet Use Command::setHelperSet rather than Command#setHelperSet in exception msg Simplify exception message Add DidYouForget to exception msg --- src/Symfony/Component/Console/Command/Command.php | 5 +++++ .../Component/Console/Tests/Command/CommandTest.php | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 3d3f2c14d78a5..e4b8fb0aa7e9b 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -537,10 +537,15 @@ public function getSynopsis() * * @return mixed The helper value * + * @throws \LogicException if no HelperSet is defined * @throws \InvalidArgumentException if the helper is not defined */ public function getHelper($name) { + if (null === $this->helperSet) { + throw new \LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name)); + } + return $this->helperSet->get($name); } diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index baa7c7e3df5e1..c066bebf2e2a1 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -173,6 +173,16 @@ public function testGetHelper() $this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper'); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage Cannot retrieve helper "formatter" because there is no HelperSet defined. + */ + public function testGetHelperWithoutHelperSet() + { + $command = new \TestCommand(); + $command->getHelper('formatter'); + } + public function testMergeApplicationDefinition() { $application1 = new Application(); From fa99fbd7cf8b4283662ea39e025487c75d528098 Mon Sep 17 00:00:00 2001 From: dasmfm <2@borisklimenko.ru> Date: Wed, 27 Apr 2016 11:40:10 +0300 Subject: [PATCH 23/79] Update HTTP statuses list --- src/Symfony/Component/HttpFoundation/Response.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 37e9c9f057ada..f50bc875e80b2 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -53,7 +53,7 @@ class Response * * The list of codes is complete according to the * {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry} - * (last updated 2012-02-13). + * (last updated 2016-03-01). * * Unless otherwise noted, the status code is defined in RFC2616. * @@ -101,6 +101,7 @@ class Response 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', // RFC2324 + 421 => 'Misdirected Request', // RFC7540 422 => 'Unprocessable Entity', // RFC4918 423 => 'Locked', // RFC4918 424 => 'Failed Dependency', // RFC4918 From 4a065b44dd9056a4173b1a2e9cc2fb95d078cfdb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 13 May 2016 10:31:27 -0500 Subject: [PATCH 24/79] added missing constant in Response --- src/Symfony/Component/HttpFoundation/Response.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index e6373b8ef2de3..62b67cce85744 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -59,6 +59,7 @@ class Response const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; const HTTP_EXPECTATION_FAILED = 417; const HTTP_I_AM_A_TEAPOT = 418; // RFC2324 + const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540 const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918 const HTTP_LOCKED = 423; // RFC4918 const HTTP_FAILED_DEPENDENCY = 424; // RFC4918 From ae38660fdeb22937b2ad9dd932b95b22146f951d Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 11 May 2016 01:50:58 +0900 Subject: [PATCH 25/79] [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper --- .../ViolationMapper/ViolationMapperTest.php | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index a099e104595ff..74da4aee1c281 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -1542,24 +1542,39 @@ public function testErrorMappingForFormInheritingParentData($target, $childName, public function testBacktrackIfSeveralSubFormsWithSamePropertyPath() { - $violation = $this->getConstraintViolation('data.address[street]'); $parent = $this->getForm('parent'); $child1 = $this->getForm('subform1', 'address'); $child2 = $this->getForm('subform2', 'address'); - $grandChild = $this->getForm('street'); + $child3 = $this->getForm('subform3', null, null, array(), true); + $child4 = $this->getForm('subform4', null, null, array(), true); + $grandChild1 = $this->getForm('street'); + $grandChild2 = $this->getForm('street', '[sub_address1_street]'); + $grandChild3 = $this->getForm('street', '[sub_address2_street]'); $parent->add($child1); $parent->add($child2); - $child2->add($grandChild); + $parent->add($child3); + $parent->add($child4); + $child2->add($grandChild1); + $child3->add($grandChild2); + $child4->add($grandChild3); $parent->submit(array()); - $this->mapper->mapViolation($violation, $parent); + $violation1 = $this->getConstraintViolation('data.address[street]'); + $violation2 = $this->getConstraintViolation('data[sub_address1_street]'); + $violation3 = $this->getConstraintViolation('data[sub_address2_street]'); + $this->mapper->mapViolation($violation1, $parent); + $this->mapper->mapViolation($violation2, $parent); + $this->mapper->mapViolation($violation3, $parent); - // The error occurred on the child of the second form with the same path $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $child1->getErrors(), $child1->getName().' should not have an error, but has one'); $this->assertCount(0, $child2->getErrors(), $child2->getName().' should not have an error, but has one'); - $this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChild->getName().' should have an error, but has none'); + $this->assertCount(0, $child3->getErrors(), $child3->getName().' should not have an error, but has one'); + $this->assertCount(0, $child4->getErrors(), $child4->getName().' should not have an error, but has one'); + $this->assertEquals(array($this->getFormError($violation1, $grandChild1)), iterator_to_array($grandChild1->getErrors()), $grandChild1->getName().' should have an error, but has none'); + $this->assertEquals(array($this->getFormError($violation2, $grandChild2)), iterator_to_array($grandChild2->getErrors()), $grandChild2->getName().' should have an error, but has none'); + $this->assertEquals(array($this->getFormError($violation3, $grandChild3)), iterator_to_array($grandChild3->getErrors()), $grandChild3->getName().' should have an error, but has none'); } } From 99f61d6df306119130037c15488a3d4c38b4f223 Mon Sep 17 00:00:00 2001 From: Philippe Degeeter Date: Mon, 11 Apr 2016 17:38:02 +0200 Subject: [PATCH 26/79] [BUG] Delete class 'control-group' in bootstrap 3 --- .../views/Form/bootstrap_3_layout.html.twig | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 0fb3f769b8391..ef2035ab43f04 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -94,14 +94,12 @@ {% block choice_widget_expanded -%} {% if '-inline' in label_attr.class|default('') -%} -
- {%- for child in form %} - {{- form_widget(child, { - parent_label_class: label_attr.class|default(''), - translation_domain: choice_translation_domain, - }) -}} - {% endfor -%} -
+ {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + }) -}} + {% endfor -%} {%- else -%}
{%- for child in form %} From 081ad731b6178333d26ba307ab4676e48124d576 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Mon, 2 May 2016 12:14:36 +0100 Subject: [PATCH 27/79] [console][table] adjust width of colspanned cell. --- .../Component/Console/Helper/Table.php | 16 +++- .../Console/Tests/Helper/TableTest.php | 74 ++++++++++--------- 2 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index dc038e4707c16..09fd3e87276e1 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -569,6 +569,18 @@ private function calculateColumnsWidth($rows) continue; } + foreach ($row as $i => $cell) { + if ($cell instanceof TableCell) { + $textLength = strlen($cell); + if ($textLength > 0) { + $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan())); + foreach ($contentColumns as $position => $content) { + $row[$i + $position] = $content; + } + } + } + } + $lengths[] = $this->getCellWidth($row, $column); } @@ -599,10 +611,6 @@ private function getCellWidth(array $row, $column) if (isset($row[$column])) { $cell = $row[$column]; $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); - if ($cell instanceof TableCell && $cell->getColspan() > 1) { - // we assume that cell value will be across more than one column. - $cellWidth = $cellWidth / $cell->getColspan(); - } return $cellWidth; } diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index d917d69591aa8..9ecb381a80090 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -269,21 +269,27 @@ public function testRenderProvider() '9971-5-0210-0', new TableCell("A Tale of \nTwo Cities", array('colspan' => 2)), ), + new TableSeparator(), + array( + new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', array('colspan' => 3)), + ), ), 'default', <<
Date: Fri, 13 May 2016 08:41:30 -0500 Subject: [PATCH 28/79] Fix computation of PR diffs for component matrix lines --- .travis.php | 5 ++--- .travis.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.php b/.travis.php index 511e05008a335..7618c272e88ee 100644 --- a/.travis.php +++ b/.travis.php @@ -1,20 +1,19 @@ $_SERVER['argc']) { - echo "Usage: commit-range branch dir1 dir2 ... dirN\n"; + echo "Usage: branch dir1 dir2 ... dirN\n"; exit(1); } $dirs = $_SERVER['argv']; array_shift($dirs); -$range = array_shift($dirs); $branch = array_shift($dirs); $packages = array(); $flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0; foreach ($dirs as $dir) { - if (!`git diff --name-only $range -- $dir`) { + if (!`git diff --name-only $branch...HEAD -- $dir`) { continue; } echo "$dir\n"; diff --git a/.travis.yml b/.travis.yml index 59e065e48d71c..3522207883bf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ before_install: install: - if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components - - if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi + - if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_BRANCH $COMPONENTS; fi # For the master branch when deps=high, the version before master is checked out and tested with the locally patched components - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi From 834f55026345ffc220995091b2095c6651ec38dd Mon Sep 17 00:00:00 2001 From: Mathieu Lemoine Date: Fri, 13 May 2016 15:34:52 -0400 Subject: [PATCH 29/79] [DX][DI] Make Autowiring exceptions more future friendly --- .../Compiler/AutowirePass.php | 15 +++++--- .../Tests/Compiler/AutowirePassTest.php | 37 ++++++++++--------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index e4457d4608451..a7812fe03d683 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -225,13 +225,16 @@ private function set($type, $id) private function createAutowiredDefinition(\ReflectionClass $typeHint, $id) { if (isset($this->notGuessableTypes[$typeHint->name])) { - throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". Several services implementing this type have been declared: "%s".', $typeHint->name, $id, implode('", "', $this->types[$typeHint->name]))); - } + $classOrInterface = $typeHint->isInterface() ? 'interface' : 'class'; + $matchingServices = implode(', ', $this->types[$typeHint->name]); + + throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". Multiple services exist for this %s (%s).', $typeHint->name, $id, $classOrInterface, $matchingServices)); - $noAvailableDefinitionMessage = sprintf('Unable to autowire argument of type "%s" for the service "%s". This type cannot be instantiated automatically and no service implementing this type is declared.', $typeHint->name, $id); + } if (!$typeHint->isInstantiable()) { - throw new RuntimeException($noAvailableDefinitionMessage); + $classOrInterface = $typeHint->isInterface() ? 'interface' : 'class'; + throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeHint->name, $id, $classOrInterface)); } $argumentId = sprintf('autowired.%s', $typeHint->name); @@ -244,7 +247,9 @@ private function createAutowiredDefinition(\ReflectionClass $typeHint, $id) try { $this->completeDefinition($argumentId, $argumentDefinition); } catch (RuntimeException $e) { - throw new RuntimeException($noAvailableDefinitionMessage, 0, $e); + $classOrInterface = $typeHint->isInterface() ? 'interface' : 'class'; + $message = sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeHint->name, $id, $classOrInterface); + throw new RuntimeException($message, 0, $e); } return new Reference($argumentId); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index 6098d9a9131c8..b5badc31fdbcd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -103,7 +103,7 @@ public function testCompleteExistingDefinitionWithNotDefinedArguments() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException - * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" for the service "a". Several services implementing this type have been declared: "c1", "c2". + * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" for the service "a". Multiple services exist for this interface (c1, c2, c3). */ public function testTypeCollision() { @@ -111,6 +111,7 @@ public function testTypeCollision() $container->register('c1', __NAMESPACE__.'\CollisionA'); $container->register('c2', __NAMESPACE__.'\CollisionB'); + $container->register('c3', __NAMESPACE__.'\CollisionB'); $aDefinition = $container->register('a', __NAMESPACE__.'\CannotBeAutowired'); $aDefinition->setAutowired(true); @@ -120,7 +121,7 @@ public function testTypeCollision() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException - * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\Foo" for the service "a". Several services implementing this type have been declared: "a1", "a2". + * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\Foo" for the service "a". Multiple services exist for this class (a1, a2). */ public function testTypeNotGuessable() { @@ -137,7 +138,7 @@ public function testTypeNotGuessable() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException - * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\A" for the service "a". Several services implementing this type have been declared: "a1", "a2". + * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\A" for the service "a". Multiple services exist for this class (a1, a2). */ public function testTypeNotGuessableWithSubclass() { @@ -152,6 +153,21 @@ public function testTypeNotGuessableWithSubclass() $pass->process($container); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" for the service "a". No services were found matching this interface and it cannot be auto-registered. + */ + public function testTypeNotGuessableNoServicesFound() + { + $container = new ContainerBuilder(); + + $aDefinition = $container->register('a', __NAMESPACE__.'\CannotBeAutowired'); + $aDefinition->setAutowired(true); + + $pass = new AutowirePass(); + $pass->process($container); + } + public function testTypeNotGuessableWithTypeSet() { $container = new ContainerBuilder(); @@ -207,21 +223,6 @@ public function testCreateDefinition() $this->assertEquals(__NAMESPACE__.'\Lille', $lilleDefinition->getClass()); } - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException - * @expectedExceptionMessage Unable to autowire argument of type "Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface" for the service "a". This type cannot be instantiated automatically and no service implementing this type is declared. - */ - public function testCreateNonInstanciable() - { - $container = new ContainerBuilder(); - - $aDefinition = $container->register('a', __NAMESPACE__.'\CannotBeAutowired'); - $aDefinition->setAutowired(true); - - $pass = new AutowirePass(); - $pass->process($container); - } - public function testResolveParameter() { $container = new ContainerBuilder(); From 7d9e74e340134e3288b8d11525e8319ba592af99 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 14 May 2016 13:17:24 +0200 Subject: [PATCH 30/79] remove methods that were needed for PHP 5.3 --- .../Console/Helper/ProgressIndicator.php | 42 ++----------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/ProgressIndicator.php b/src/Symfony/Component/Console/Helper/ProgressIndicator.php index ccf9771bcf9e4..f90a85c2918ca 100644 --- a/src/Symfony/Component/Console/Helper/ProgressIndicator.php +++ b/src/Symfony/Component/Console/Helper/ProgressIndicator.php @@ -76,42 +76,6 @@ public function setMessage($message) $this->display(); } - /** - * Gets the current indicator message. - * - * @return string|null - * - * @internal for PHP 5.3 compatibility - */ - public function getMessage() - { - return $this->message; - } - - /** - * Gets the progress bar start time. - * - * @return int The progress bar start time - * - * @internal for PHP 5.3 compatibility - */ - public function getStartTime() - { - return $this->startTime; - } - - /** - * Gets the current animated indicator character. - * - * @return string - * - * @internal for PHP 5.3 compatibility - */ - public function getCurrentValue() - { - return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)]; - } - /** * Starts the indicator output. * @@ -294,13 +258,13 @@ private static function initPlaceholderFormatters() { return array( 'indicator' => function (ProgressIndicator $indicator) { - return $indicator->getCurrentValue(); + return $indicator->indicatorValues[$indicator->indicatorCurrent % count($indicator->indicatorValues)]; }, 'message' => function (ProgressIndicator $indicator) { - return $indicator->getMessage(); + return $indicator->message; }, 'elapsed' => function (ProgressIndicator $indicator) { - return Helper::formatTime(time() - $indicator->getStartTime()); + return Helper::formatTime(time() - $indicator->startTime); }, 'memory' => function () { return Helper::formatMemory(memory_get_usage(true)); From f8dd87d7cc2e9c2551322662fb3d9bed7f332d3c Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Sat, 2 Apr 2016 12:30:41 +0200 Subject: [PATCH 31/79] [WebProfilerBundle] Fix CORS ajax security issues --- .../Resources/views/Profiler/base_js.html.twig | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index 8c10c95655317..d9f92ca26a33e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -80,6 +80,20 @@ requestStack = [], + extractHeaders = function(xhr, stackElement) { + // Here we avoid to call xhr.getResponseHeader in order to + // prevent polluting the console with CORS security errors + var allHeaders = xhr.getAllResponseHeaders(); + var ret; + + if (ret = allHeaders.match(/^x-debug-token:\s+(.*)$/im)) { + stackElement.profile = ret[1]; + } + if (ret = allHeaders.match(/^x-debug-token-link:\s+(.*)$/im)) { + stackElement.profilerUrl = ret[1]; + } + }, + renderAjaxRequests = function() { var requestCounter = document.querySelectorAll('.sf-toolbar-ajax-requests'); if (!requestCounter.length) { @@ -239,8 +253,8 @@ stackElement.duration = new Date() - stackElement.start; stackElement.loading = false; stackElement.error = self.status < 200 || self.status >= 400; - stackElement.profile = self.getResponseHeader("X-Debug-Token"); - stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link"); + + extractHeaders(self, stackElement); Sfjs.renderAjaxRequests(); } From ac7f74eccac01ce7b279c41b72f1422e575e67f6 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 17 May 2016 14:52:22 +0200 Subject: [PATCH 32/79] Use levenshtein level for better Bundle matching --- .../Controller/ControllerNameParser.php | 1 + .../Tests/Controller/ControllerNameParserTest.php | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php index 873c736841ba8..374d0eba10ff6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php @@ -142,6 +142,7 @@ private function findAlternative($nonExistentBundleName) $lev = levenshtein($nonExistentBundleName, $bundleName); if ($lev <= strlen($nonExistentBundleName) / 3 && ($alternative === null || $lev < $shortest)) { $alternative = $bundleName; + $shortest = $lev; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php index 4718c1eb0b238..0fe47b0908d83 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php @@ -59,8 +59,8 @@ public function testBuild() { $parser = $this->createParser(); - $this->assertEquals('FooBundle:Default:index', $parser->build('TestBundle\FooBundle\Controller\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string'); - $this->assertEquals('FooBundle:Sub\Default:index', $parser->build('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string'); + $this->assertEquals('FoooooBundle:Default:index', $parser->build('TestBundle\FooBundle\Controller\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string'); + $this->assertEquals('FoooooBundle:Sub\Default:index', $parser->build('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string'); try { $parser->build('TestBundle\FooBundle\Controller\DefaultController::index'); @@ -132,8 +132,9 @@ public function testInvalidBundleName($bundleName, $suggestedBundleName) public function getInvalidBundleNameTests() { return array( - array('FoodBundle:Default:index', 'FooBundle:Default:index'), - array('CrazyBundle:Default:index', false), + 'Alternative will be found using levenshtein' => array('FoodBundle:Default:index', 'FooBundle:Default:index'), + 'Alternative will be found using partial match' => array('FabpotFooBund:Default:index', 'FabpotFooBundle:Default:index'), + 'Bundle does not exist at all' => array('CrazyBundle:Default:index', false), ); } @@ -162,6 +163,7 @@ private function createParser() $bundles = array( 'SensioFooBundle' => $this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'), 'SensioCmsFooBundle' => $this->getBundle('TestBundle\Sensio\Cms\FooBundle', 'SensioCmsFooBundle'), + 'FoooooBundle' => $this->getBundle('TestBundle\FooBundle', 'FoooooBundle'), 'FooBundle' => $this->getBundle('TestBundle\FooBundle', 'FooBundle'), 'FabpotFooBundle' => $this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'), ); From 187b64561586b81a0c8896328826cbe5dcb51e5a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 17 May 2016 18:47:41 +0200 Subject: [PATCH 33/79] [FrameworkBundle] update upgrade instructions --- UPGRADE-3.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 8925b911890e0..327a36bf93c8e 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -636,6 +636,11 @@ UPGRADE FROM 2.x to 3.0 be removed in Symfony 3.0. Use the `debug:config`, `debug:container`, `debug:router`, `debug:translation` and `lint:yaml` commands instead. + * The base `Controller`class is now abstract. + + * The visibility of all methods of the base `Controller` class has been changed from + `public` to `protected`. + * The `getRequest` method of the base `Controller` class has been deprecated since Symfony 2.4 and must be therefore removed in 3.0. The only reliable way to get the `Request` object is to inject it in the action method. From f49659f1372d4bfc9d9616f92c316e4cc5fd8726 Mon Sep 17 00:00:00 2001 From: Krzysiek Piasecki Date: Thu, 12 May 2016 08:29:24 +0200 Subject: [PATCH 34/79] [Validator] Support for DateTimeImmutable --- .../Component/Validator/Constraints/DateTimeValidator.php | 2 +- .../Component/Validator/Constraints/DateValidator.php | 2 +- .../Validator/Tests/Constraints/DateTimeValidatorTest.php | 7 +++++++ .../Validator/Tests/Constraints/DateValidatorTest.php | 7 +++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php b/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php index 8d82bd8ca9a4b..0a867a7d4b25b 100644 --- a/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php @@ -30,7 +30,7 @@ public function validate($value, Constraint $constraint) throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\DateTime'); } - if (null === $value || '' === $value || $value instanceof \DateTime) { + if (null === $value || '' === $value || $value instanceof \DateTimeInterface) { return; } diff --git a/src/Symfony/Component/Validator/Constraints/DateValidator.php b/src/Symfony/Component/Validator/Constraints/DateValidator.php index bfeb5fca30ef3..ed836de9aced2 100644 --- a/src/Symfony/Component/Validator/Constraints/DateValidator.php +++ b/src/Symfony/Component/Validator/Constraints/DateValidator.php @@ -47,7 +47,7 @@ public function validate($value, Constraint $constraint) throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Date'); } - if (null === $value || '' === $value || $value instanceof \DateTime) { + if (null === $value || '' === $value || $value instanceof \DateTimeInterface) { return; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php index ebb1f3e6b74fb..dbc4d1aa688d3 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php @@ -42,6 +42,13 @@ public function testDateTimeClassIsValid() $this->assertNoViolation(); } + public function testDateTimeImmutableClassIsValid() + { + $this->validator->validate(new \DateTimeImmutable(), new DateTime()); + + $this->assertNoViolation(); + } + /** * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException */ diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php index 67bb2340c3630..ec62de6281c58 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php @@ -42,6 +42,13 @@ public function testDateTimeClassIsValid() $this->assertNoViolation(); } + public function testDateTimeImmutableClassIsValid() + { + $this->validator->validate(new \DateTimeImmutable(), new Date()); + + $this->assertNoViolation(); + } + /** * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException */ From 2718a6c764416ede6afa87fe4aaa28a480b93091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20We=C3=9Fling?= Date: Sat, 30 Apr 2016 12:40:11 +0200 Subject: [PATCH 35/79] [DependencyInjection] Avoid generating call_user_func in more cases --- .../DependencyInjection/Dumper/PhpDumper.php | 8 +++ .../Tests/Fixtures/containers/container9.php | 18 +++++ .../Tests/Fixtures/graphviz/services9.dot | 4 ++ .../Tests/Fixtures/php/services19.php | 2 +- .../Tests/Fixtures/php/services9.php | 68 +++++++++++++++++++ .../Tests/Fixtures/php/services9_compiled.php | 32 +++++++++ .../Tests/Fixtures/xml/services9.xml | 12 ++++ .../Tests/Fixtures/yaml/services9.yml | 14 ++++ 8 files changed, 157 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index e0a763dfe8d5b..ba7fa385d8cd2 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -537,6 +537,10 @@ private function addServiceConfigurator($id, $definition, $variableName = 'insta return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName); } + if (0 === strpos($class, 'new ')) { + return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + } + return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } @@ -713,6 +717,10 @@ private function addNewInstance(Definition $definition, $return, $instantiation) return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? implode(', ', $arguments) : ''); } + if (0 === strpos($class, 'new ')) { + return sprintf(" $return{$instantiation}(%s)->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : ''); + } + return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php index 96f334fdd153f..f499635604bed 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -78,6 +78,15 @@ ->register('configured_service', 'stdClass') ->setConfigurator(array(new Reference('configurator_service'), 'configureStdClass')) ; +$container + ->register('configurator_service_simple', 'ConfClass') + ->addArgument('bar') + ->setPublic(false) +; +$container + ->register('configured_service_simple', 'stdClass') + ->setConfigurator(array(new Reference('configurator_service_simple'), 'configureStdClass')) +; $container ->register('decorated', 'stdClass') ; @@ -111,5 +120,14 @@ ->register('service_from_static_method', 'Bar\FooClass') ->setFactory(array('Bar\FooClass', 'getInstance')) ; +$container + ->register('factory_simple', 'SimpleFactoryClass') + ->addArgument('foo') + ->setPublic(false) +; +$container + ->register('factory_service_simple', 'Bar') + ->setFactory(array(new Reference('factory_simple'), 'getInstance')) +; return $container; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot index f6536980aa54f..3b24ef8ffbca3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot @@ -14,6 +14,8 @@ digraph sc { node_request [label="request\nRequest\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_configurator_service [label="configurator_service\nConfClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_configured_service [label="configured_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_configurator_service_simple [label="configurator_service_simple\nConfClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_configured_service_simple [label="configured_service_simple\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_decorated [label="decorated\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_decorator_service [label="decorator_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_decorator_service_with_name [label="decorator_service_with_name\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; @@ -22,6 +24,8 @@ digraph sc { node_factory_service [label="factory_service\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_new_factory_service [label="new_factory_service\nFooBarBaz\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_service_from_static_method [label="service_from_static_method\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_factory_simple [label="factory_simple\nSimpleFactoryClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_factory_service_simple [label="factory_service_simple\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"]; node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; node_foo2 [label="foo2\n\n", shape=record, fillcolor="#ff9999", style="filled"]; node_foo3 [label="foo3\n\n", shape=record, fillcolor="#ff9999", style="filled"]; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php index cc2a18dcd1d57..6c56cfcebf700 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php @@ -40,7 +40,7 @@ public function __construct() */ protected function getServiceFromAnonymousFactoryService() { - return $this->services['service_from_anonymous_factory'] = call_user_func(array(new \Bar\FooClass(), 'getInstance')); + return $this->services['service_from_anonymous_factory'] = (new \Bar\FooClass())->getInstance(); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index a29f7dd768c51..cb84452bcad87 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -28,12 +28,16 @@ public function __construct() 'bar' => 'getBarService', 'baz' => 'getBazService', 'configurator_service' => 'getConfiguratorServiceService', + 'configurator_service_simple' => 'getConfiguratorServiceSimpleService', 'configured_service' => 'getConfiguredServiceService', + 'configured_service_simple' => 'getConfiguredServiceSimpleService', 'decorated' => 'getDecoratedService', 'decorator_service' => 'getDecoratorServiceService', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', 'deprecated_service' => 'getDeprecatedServiceService', 'factory_service' => 'getFactoryServiceService', + 'factory_service_simple' => 'getFactoryServiceSimpleService', + 'factory_simple' => 'getFactorySimpleService', 'foo' => 'getFooService', 'foo.baz' => 'getFoo_BazService', 'foo_bar' => 'getFooBarService', @@ -104,6 +108,23 @@ protected function getConfiguredServiceService() return $instance; } + /** + * Gets the 'configured_service_simple' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getConfiguredServiceSimpleService() + { + $this->services['configured_service_simple'] = $instance = new \stdClass(); + + $this->get('configurator_service_simple')->configureStdClass($instance); + + return $instance; + } + /** * Gets the 'decorated' service. * @@ -173,6 +194,19 @@ protected function getFactoryServiceService() return $this->services['factory_service'] = $this->get('foo.baz')->getInstance(); } + /** + * Gets the 'factory_service_simple' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar A Bar instance. + */ + protected function getFactoryServiceSimpleService() + { + return $this->services['factory_service_simple'] = $this->get('factory_simple')->getInstance(); + } + /** * Gets the 'foo' service. * @@ -334,6 +368,40 @@ protected function getConfiguratorServiceService() return $instance; } + /** + * Gets the 'configurator_service_simple' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * This service is private. + * If you want to be able to request this service from the container directly, + * make it public, otherwise you might end up with broken code. + * + * @return \ConfClass A ConfClass instance. + */ + protected function getConfiguratorServiceSimpleService() + { + return $this->services['configurator_service_simple'] = new \ConfClass('bar'); + } + + /** + * Gets the 'factory_simple' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * This service is private. + * If you want to be able to request this service from the container directly, + * make it public, otherwise you might end up with broken code. + * + * @return \SimpleFactoryClass A SimpleFactoryClass instance. + */ + protected function getFactorySimpleService() + { + return $this->services['factory_simple'] = new \SimpleFactoryClass('foo'); + } + /** * Gets the 'inlined' service. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 5386b12a99457..4fd1ac90f3faf 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -30,10 +30,12 @@ public function __construct() 'bar' => 'getBarService', 'baz' => 'getBazService', 'configured_service' => 'getConfiguredServiceService', + 'configured_service_simple' => 'getConfiguredServiceSimpleService', 'decorator_service' => 'getDecoratorServiceService', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', 'deprecated_service' => 'getDeprecatedServiceService', 'factory_service' => 'getFactoryServiceService', + 'factory_service_simple' => 'getFactoryServiceSimpleService', 'foo' => 'getFooService', 'foo.baz' => 'getFoo_BazService', 'foo_bar' => 'getFooBarService', @@ -114,6 +116,23 @@ protected function getConfiguredServiceService() return $instance; } + /** + * Gets the 'configured_service_simple' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getConfiguredServiceSimpleService() + { + $this->services['configured_service_simple'] = $instance = new \stdClass(); + + (new \ConfClass('bar'))->configureStdClass($instance); + + return $instance; + } + /** * Gets the 'decorator_service' service. * @@ -170,6 +189,19 @@ protected function getFactoryServiceService() return $this->services['factory_service'] = $this->get('foo.baz')->getInstance(); } + /** + * Gets the 'factory_service_simple' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar A Bar instance. + */ + protected function getFactoryServiceSimpleService() + { + return $this->services['factory_service_simple'] = (new \SimpleFactoryClass('foo'))->getInstance(); + } + /** * Gets the 'foo' service. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml index 4ddb8655c55f2..d3974c07b01a7 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -84,6 +84,12 @@ + + bar + + + + @@ -103,6 +109,12 @@ + + foo + + + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index 6efeb37e747d4..4a97dcadffa66 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -67,6 +67,13 @@ services: configured_service: class: stdClass configurator: ['@configurator_service', configureStdClass] + configurator_service_simple: + class: ConfClass + public: false + arguments: ['bar'] + configured_service_simple: + class: stdClass + configurator: ['@configurator_service_simple', configureStdClass] decorated: class: stdClass decorator_service: @@ -93,5 +100,12 @@ services: service_from_static_method: class: Bar\FooClass factory: [Bar\FooClass, getInstance] + factory_simple: + class: SimpleFactoryClass + public: false + arguments: ['foo'] + factory_service_simple: + class: Bar + factory: ['@factory_simple', getInstance] alias_for_foo: '@foo' alias_for_alias: '@foo' From 103526b40f6cfc46ad2f627e4e19c8f02cc08276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Thu, 12 May 2016 17:11:08 +0200 Subject: [PATCH 36/79] Catch \Throwable --- src/Symfony/Component/Debug/DebugClassLoader.php | 4 ++++ src/Symfony/Component/Debug/ErrorHandler.php | 6 ++++++ src/Symfony/Component/OptionsResolver/OptionsResolver.php | 6 ++++++ src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php | 2 ++ 4 files changed, 18 insertions(+) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 36afa369301b2..603c814b569ea 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -175,6 +175,10 @@ public function loadClass($class) } catch (\Exception $e) { ErrorHandler::unstackErrors(); + throw $e; + } catch (\Throwable $e) { + ErrorHandler::unstackErrors(); + throw $e; } diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 33779af3251e7..9c30ffea4461a 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -447,6 +447,10 @@ public function handleError($type, $message, $file, $line, array $context, array } catch (\Exception $e) { $this->isRecursive = false; + throw $e; + } catch (\Throwable $e) { + $this->isRecursive = false; + throw $e; } } @@ -555,6 +559,8 @@ public static function handleFatalError(array $error = null) } } catch (\Exception $exception) { // Handled below + } catch (\Throwable $exception) { + // Handled below } if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) { diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index e0578af71781d..bc763202f228a 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -861,6 +861,9 @@ public function offsetGet($option) } catch (\Exception $e) { unset($this->calling[$option]); throw $e; + } catch (\Throwable $e) { + unset($this->calling[$option]); + throw $e; } unset($this->calling[$option]); // END @@ -963,6 +966,9 @@ public function offsetGet($option) } catch (\Exception $e) { unset($this->calling[$option]); throw $e; + } catch (\Throwable $e) { + unset($this->calling[$option]); + throw $e; } unset($this->calling[$option]); // END diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index cc4b2ef498974..1035bd70c292f 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -141,6 +141,8 @@ public function dump(Data $data, $output = null) $this->dumpLine(-1); } catch (\Exception $exception) { // Re-thrown below + } catch (\Throwable $exception) { + // Re-thrown below } if ($output) { $this->setOutput($prevOutput); From de671f4cb2299f46fdbbd43e3bc747e813b0a90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Thu, 12 May 2016 17:11:08 +0200 Subject: [PATCH 37/79] Catch \Throwable --- .../Component/DependencyInjection/Compiler/AutowirePass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index e4457d4608451..7bb0516dc02e2 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -44,8 +44,8 @@ public function process(ContainerBuilder $container) $this->completeDefinition($id, $definition); } } - } catch (\Error $e) { } catch (\Exception $e) { + } catch (\Throwable $e) { } spl_autoload_unregister($throwingAutoloader); From 3234ca491c20f3b173448115838056ac284b8c80 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 19 May 2016 21:50:23 +0200 Subject: [PATCH 38/79] fix removed commands wording in upgrade file --- UPGRADE-3.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 35823d8aaf234..aef162311c169 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1604,8 +1604,7 @@ UPGRADE FROM 2.x to 3.0 ### WebProfiler - * The `profiler:import` and `profiler:export` commands have been deprecated and - will be removed in 3.0. + * The `profiler:import` and `profiler:export` commands have been removed. * All the profiler storages different than `FileProfilerStorage` have been removed. The removed classes are: From cd66a452c6576fd308716f1c20905c08d20903f2 Mon Sep 17 00:00:00 2001 From: bradbyu Date: Fri, 13 May 2016 10:45:14 -0400 Subject: [PATCH 39/79] Update UPGRADE FROM 2.x to 3.0 --- UPGRADE-3.0.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 475fcbbc80d56..467c13e6448ca 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -132,7 +132,10 @@ UPGRADE FROM 2.x to 3.0 ### Form - * The `ChoiceToBooleanArrayTransformer`, `ChoicesToBooleanArrayTransformer`, + * The `max_length` option was removed. Use the `attr` option instead by setting it to + an `array` with a `maxlength` key. + + * The `ChoiceToBooleanArrayTransformer`, `ChoicesToBooleanArrayTransformer`, `FixRadioInputListener`, and `FixCheckboxInputListener` classes were removed. * The `choice_list` option of `ChoiceType` was removed. From 94e4706609b5bfe5f0ac2c26f53141042a65b55c Mon Sep 17 00:00:00 2001 From: Peter Rehm Date: Thu, 19 May 2016 16:20:34 +0200 Subject: [PATCH 40/79] Fixed server status command when port has been omitted --- .../Bundle/FrameworkBundle/Command/ServerStatusCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php index 2c6d2c49ff09c..fa5c537a0c97a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php @@ -13,6 +13,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** @@ -31,6 +32,7 @@ protected function configure() $this ->setDefinition(array( new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'), + new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'), )) ->setName('server:status') ->setDescription('Outputs the status of the built-in web server for the given address') @@ -44,6 +46,10 @@ protected function execute(InputInterface $input, OutputInterface $output) { $address = $input->getArgument('address'); + if (false === strpos($address, ':')) { + $address = $address.':'.$input->getOption('port'); + } + // remove an orphaned lock file if (file_exists($this->getLockFile($address)) && !$this->isServerRunning($address)) { unlink($this->getLockFile($address)); From a4b1fa669432ff433df65a7e89e122c3d7d8b892 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 14 May 2016 17:57:37 +0200 Subject: [PATCH 41/79] chomp newlines only at the end of YAML documents --- src/Symfony/Component/Yaml/Parser.php | 26 ++++++++++++++----- .../Component/Yaml/Tests/ParserTest.php | 3 ++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index a37e3e69484cb..67f780aaae376 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -25,6 +25,7 @@ class Parser const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN; private $offset = 0; + private $totalNumberOfLines; private $lines = array(); private $currentLineNb = -1; private $currentLine = ''; @@ -33,11 +34,13 @@ class Parser /** * Constructor. * - * @param int $offset The offset of YAML document (used for line numbers in error messages) + * @param int $offset The offset of YAML document (used for line numbers in error messages) + * @param int|null $totalNumberOfLines The overall number of lines being parsed */ - public function __construct($offset = 0) + public function __construct($offset = 0, $totalNumberOfLines = null) { $this->offset = $offset; + $this->totalNumberOfLines = $totalNumberOfLines; } /** @@ -61,6 +64,10 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $value = $this->cleanup($value); $this->lines = explode("\n", $value); + if (null === $this->totalNumberOfLines) { + $this->totalNumberOfLines = count($this->lines); + } + if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('UTF-8'); @@ -93,7 +100,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = // array if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); + $parser = new self($c, $this->totalNumberOfLines); $parser->refs = &$this->refs; $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport); } else { @@ -102,7 +109,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = ) { // this is a compact notation element, add to next block and parse $c = $this->getRealCurrentLineNb(); - $parser = new self($c); + $parser = new self($c, $this->totalNumberOfLines); $parser->refs = &$this->refs; $block = $values['value']; @@ -153,7 +160,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $value = $this->getNextEmbedBlock(); } $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); + $parser = new self($c, $this->totalNumberOfLines); $parser->refs = &$this->refs; $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport); @@ -190,7 +197,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $data[$key] = null; } else { $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); + $parser = new self($c, $this->totalNumberOfLines); $parser->refs = &$this->refs; $data[$key] = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport); } @@ -528,6 +535,8 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) if ($notEOF) { $blockLines[] = ''; $this->moveToPreviousLine(); + } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { + $blockLines[] = ''; } // folded style @@ -634,6 +643,11 @@ private function isCurrentLineComment() return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#'; } + private function isCurrentLineLastLineInDocument() + { + return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); + } + /** * Cleanups a YAML string to be parsed. * diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 34cc81b2d353a..6645c36108069 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -826,6 +826,7 @@ public function getCommentLikeStringInScalarBlockData() foo # bar baz + EOT , ), @@ -854,7 +855,7 @@ public function getCommentLikeStringInScalarBlockData() $expected = array( 'foo' => array( 'bar' => array( - 'scalar-block' => 'line1 line2>', + 'scalar-block' => "line1 line2>\n", ), 'baz' => array( 'foobar' => null, From c2f7fedfd6494ac8e97347e554b0d3d16f7086eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 22 May 2016 13:47:44 +0200 Subject: [PATCH 42/79] [Serializer] Add test for ignored attributes during denormalization --- .../Tests/Normalizer/ObjectNormalizerTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index c0602d7fa6b7d..398a579b9fa75 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -324,6 +324,19 @@ public function testIgnoredAttributes() ); } + public function testIgnoredAttributesDenormalize() + { + $this->normalizer->setIgnoredAttributes(array('fooBar', 'bar', 'baz')); + + $obj = new ObjectDummy(); + $obj->setFoo('foo'); + + $this->assertEquals( + $obj, + $this->normalizer->denormalize(array('fooBar' => 'fooBar', 'foo' => 'foo', 'baz' => 'baz'), __NAMESPACE__.'\ObjectDummy') + ); + } + public function provideCallbacks() { return array( From 717e1a9e47d0899efcb65676cf10285a43a03a23 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 22 May 2016 18:02:36 +0200 Subject: [PATCH 43/79] [Yaml] properly handle unindented collections --- src/Symfony/Component/Yaml/Parser.php | 2 +- .../Component/Yaml/Tests/ParserTest.php | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index a37e3e69484cb..d27968bb40827 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -711,7 +711,7 @@ private function isNextLineUnIndentedCollection() */ private function isStringUnIndentedCollectionItem() { - return 0 === strpos($this->currentLine, '- '); + return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); } /** diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 34cc81b2d353a..ba4064272a827 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -557,6 +557,34 @@ public function testSequenceInAMapping() ); } + public function testSequenceInMappingStartedBySingleDashLine() + { + $yaml = << array( + array( + 'b' => array( + array( + 'bar' => 'baz', + ), + ), + ), + 'foo', + ), + 'd' => 'e', + ); + + $this->assertSame($expected, $this->parser->parse($yaml)); + } + /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ From 02070f9fd353df6395db1cff0a46eb0ea3cbb605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mor=C3=A1vek=20=28moravek=2Emartin=29?= Date: Sun, 22 May 2016 21:49:29 +0900 Subject: [PATCH 44/79] People - person singularization --- src/Symfony/Component/PropertyAccess/StringUtil.php | 3 +++ src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/Symfony/Component/PropertyAccess/StringUtil.php b/src/Symfony/Component/PropertyAccess/StringUtil.php index 248a6483d8b0a..caa8c3d7e1a0d 100644 --- a/src/Symfony/Component/PropertyAccess/StringUtil.php +++ b/src/Symfony/Component/PropertyAccess/StringUtil.php @@ -124,6 +124,9 @@ class StringUtil // chateaux (chateau) array('xuae', 4, false, true, 'eau'), + + // people (person) + array('elpoep', 6, true, true, 'person'), ); /** diff --git a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php index 0fd6bb69b2956..983e355cb9038 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php @@ -107,6 +107,8 @@ public function singularifyProvider() array('objectives', 'objective'), array('oxen', 'ox'), array('parties', 'party'), + array('people', 'person'), + array('persons', 'person'), array('phenomena', array('phenomenon', 'phenomenum')), array('photos', 'photo'), array('pianos', 'piano'), From 9bdaba48018b459bb8fdc3673e6155e0e418adb7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 23 May 2016 11:57:38 +0200 Subject: [PATCH 45/79] [Yaml] fix exception contexts --- src/Symfony/Component/Yaml/Parser.php | 8 ++++---- src/Symfony/Component/Yaml/Tests/ParserTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 46e7549749a48..2739723c7e78c 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -88,7 +88,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $isRef = $isInPlace = $isProcessed = false; if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping'); + throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine); } $context = 'sequence'; @@ -127,7 +127,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence'); + throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine); } $context = 'mapping'; @@ -214,7 +214,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } else { // multiple documents are not supported if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.'); + throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine); } // 1-liner optionally followed by newline(s) @@ -449,7 +449,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport) } if (!array_key_exists($value, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLine); + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine); } return $this->refs[$value]; diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index c3fc6b2ada7ce..87f0cdbb1bb7b 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -525,7 +525,7 @@ public function testShortcutKeyUnindentedCollectionException() /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException - * @expectedExceptionMessage Multiple documents are not supported. + * @expectedExceptionMessageRegExp /^Multiple documents are not supported.+/ */ public function testMultipleDocumentsNotSupportedException() { From 0d14aac8801661b75b7a4e070f9785eddadf6f70 Mon Sep 17 00:00:00 2001 From: Francis Besset Date: Fri, 20 May 2016 15:47:36 +0200 Subject: [PATCH 46/79] Removed UTC specification with timestamp --- .../DataTransformer/DateTimeToLocalizedStringTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index b38680a1bb6ec..5418f7feae919 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -126,7 +126,7 @@ public function reverseTransform($value) try { // read timestamp into DateTime object - the formatter delivers in UTC - $dateTime = new \DateTime(sprintf('@%s UTC', $timestamp)); + $dateTime = new \DateTime(sprintf('@%s', $timestamp)); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } From 91a2f5dea193d01596428fe92d2b5333d1a4730d Mon Sep 17 00:00:00 2001 From: Linnaea Von Lavia Date: Thu, 26 May 2016 10:56:28 +0800 Subject: [PATCH 47/79] Fix js comment in profiler --- .../Resources/views/Profiler/base_js.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index d9f92ca26a33e..23e05030c5862 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -81,8 +81,8 @@ requestStack = [], extractHeaders = function(xhr, stackElement) { - // Here we avoid to call xhr.getResponseHeader in order to - // prevent polluting the console with CORS security errors + /* Here we avoid to call xhr.getResponseHeader in order to */ + /* prevent polluting the console with CORS security errors */ var allHeaders = xhr.getAllResponseHeaders(); var ret; From 7cb76558ceca37d06b366dbe46aceb6ae274306d Mon Sep 17 00:00:00 2001 From: Peter Rehm Date: Wed, 25 May 2016 08:27:19 +0200 Subject: [PATCH 48/79] [Console][DX] Fixed ambiguous error message when using a duplicate option shortcut --- .../Component/Console/Command/Command.php | 4 +-- .../Console/Tests/ApplicationTest.php | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index e4b8fb0aa7e9b..9385b9d2a6680 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -287,14 +287,14 @@ public function mergeApplicationDefinition($mergeArgs = true) return; } + $this->definition->addOptions($this->application->getDefinition()->getOptions()); + if ($mergeArgs) { $currentArguments = $this->definition->getArguments(); $this->definition->setArguments($this->application->getDefinition()->getArguments()); $this->definition->addArguments($currentArguments); } - $this->definition->addOptions($this->application->getDefinition()->getOptions()); - $this->applicationDefinitionMerged = true; if ($mergeArgs) { $this->applicationDefinitionMergedWithArgs = true; diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 8e44b7ae17267..8637b0f58f39c 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -645,6 +645,33 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero() $this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0'); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage An option with shortcut "e" already exists. + */ + public function testAddingOptionWithDuplicateShortcut() + { + $dispatcher = new EventDispatcher(); + $application = new Application(); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + $application->setDispatcher($dispatcher); + + $application->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'Environment')); + + $application + ->register('foo') + ->setAliases(['f']) + ->setDefinition(array(new InputOption('survey', 'e', InputOption::VALUE_REQUIRED, 'My option with a shortcut.'))) + ->setCode(function (InputInterface $input, OutputInterface $output) {}) + ; + + $input = new ArrayInput(array('command' => 'foo')); + $output = new NullOutput(); + + $application->run($input, $output); + } + /** * @expectedException \LogicException * @dataProvider getAddingAlreadySetDefinitionElementData From 963fe1d6350e6c56ad84b1e6b76c3f389d33b130 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sun, 22 May 2016 12:24:43 +0200 Subject: [PATCH 49/79] [Console] SymfonyStyle: Align multi-line/very-long-line blocks Remove SymfonyStyle::comment() changes (out of scope) CS Fixes Add tests --- .../Component/Console/Style/SymfonyStyle.php | 19 ++++++++++++++++--- .../Style/SymfonyStyle/command/command_10.php | 17 +++++++++++++++++ .../Style/SymfonyStyle/command/command_9.php | 11 +++++++++++ .../Style/SymfonyStyle/output/output_10.txt | 7 +++++++ .../Style/SymfonyStyle/output/output_9.txt | 5 +++++ .../Console/Tests/Style/SymfonyStyleTest.php | 2 +- 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 21fc3b92cfee0..03550836cfae8 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -67,23 +67,36 @@ public function block($messages, $type = null, $style = null, $prefix = ' ', $pa { $this->autoPrependBlock(); $messages = is_array($messages) ? array_values($messages) : array($messages); + $indentLength = 0; $lines = array(); - // add type if (null !== $type) { - $messages[0] = sprintf('[%s] %s', $type, $messages[0]); + $typePrefix = sprintf('[%s] ', $type); + $indentLength = strlen($typePrefix); + $lineIndentation = str_repeat(' ', $indentLength); } // wrap and add newlines for each element foreach ($messages as $key => $message) { $message = OutputFormatter::escape($message); - $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true))); + $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix) - $indentLength, PHP_EOL, true))); + + // prefix each line with a number of spaces equivalent to the type length + if (null !== $type) { + foreach ($lines as &$line) { + $line = $lineIndentation === substr($line, 0, $indentLength) ? $line : $lineIndentation.$line; + } + } if (count($messages) > 1 && $key < count($messages) - 1) { $lines[] = ''; } } + if (null !== $type) { + $lines[0] = substr_replace($lines[0], $typePrefix, 0, $indentLength); + } + if ($padding && $this->isDecorated()) { array_unshift($lines, ''); $lines[] = ''; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php new file mode 100644 index 0000000000000..4120df9cb6b64 --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php @@ -0,0 +1,17 @@ +block( + 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', + 'CUSTOM', + 'fg=white;bg=green', + 'X ', + true + ); +}; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php new file mode 100644 index 0000000000000..0f0a4e69d0e6e --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php @@ -0,0 +1,11 @@ +block(['Custom block', 'Second custom block line'], 'CUSTOM', 'fg=white;bg=green', 'X ', true); +}; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt new file mode 100644 index 0000000000000..385c6a283c84d --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt @@ -0,0 +1,7 @@ + +X [CUSTOM] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et +X dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea +X commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat +X nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit +X anim id est laborum + diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt new file mode 100644 index 0000000000000..069c0d5119f7b --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt @@ -0,0 +1,5 @@ + +X [CUSTOM] Custom block +X +X Second custom block line + diff --git a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php index 6bf64129f4221..889a9c82f2dcb 100644 --- a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php @@ -57,7 +57,7 @@ public function inputCommandToOutputFilesProvider() public function testLongWordsBlockWrapping() { - $word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon'; + $word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygovgollhjvhvljfezefeqifzeiqgiqzhrsdgihqzridghqridghqirshdghdghieridgheirhsdgehrsdvhqrsidhqshdgihrsidvqhneriqsdvjzergetsrfhgrstsfhsetsfhesrhdgtesfhbzrtfbrztvetbsdfbrsdfbrn'; $wordLength = strlen($word); $maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3; From c59a3da6064c30269ef40b48d5424ed2b1eb4ad1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 26 May 2016 10:04:58 +0200 Subject: [PATCH 50/79] fixed PHP 5.3 compat in tests --- src/Symfony/Component/Console/Tests/ApplicationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 8637b0f58f39c..d237721647790 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -661,7 +661,7 @@ public function testAddingOptionWithDuplicateShortcut() $application ->register('foo') - ->setAliases(['f']) + ->setAliases(array('f')) ->setDefinition(array(new InputOption('survey', 'e', InputOption::VALUE_REQUIRED, 'My option with a shortcut.'))) ->setCode(function (InputInterface $input, OutputInterface $output) {}) ; From a842b97087a733348c82846241f32ffdae0fcf50 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 26 May 2016 10:21:12 +0200 Subject: [PATCH 51/79] fixed PHP 5.3 compat in tests --- .../Tests/Fixtures/Style/SymfonyStyle/command/command_9.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php index 0f0a4e69d0e6e..6420730fd64ad 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php @@ -7,5 +7,5 @@ //Ensure that all lines are aligned to the begin of the first line in a multi-line block return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyleWithForcedLineLength($input, $output); - $output->block(['Custom block', 'Second custom block line'], 'CUSTOM', 'fg=white;bg=green', 'X ', true); + $output->block(array('Custom block', 'Second custom block line'), 'CUSTOM', 'fg=white;bg=green', 'X ', true); }; From a125af74f8490fe58825a3b24c5269c73b6901c4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 29 May 2016 11:31:47 +0200 Subject: [PATCH 52/79] [PropertyAccess] Fix for PHP 7.0.7 --- .../Tests/PropertyAccessorCollectionTest.php | 4 +++- .../PropertyAccess/Tests/PropertyAccessorTest.php | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index 9f10b95e438c8..981fabaf6ed87 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -173,7 +173,9 @@ public function testSetValueUpdatesNestedArrayAccess() */ public function testSetValueThrowsExceptionIfArrayAccessExpected() { - $this->propertyAccessor->setValue(new \stdClass(), '[firstName]', 'Bernhard'); + $object = new \stdClass(); + + $this->propertyAccessor->setValue($object, '[firstName]', 'Bernhard'); } public function testSetValueCallsAdderAndRemoverForCollections() diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php index 6e1a5ed3dcefd..a06497c7749aa 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php @@ -311,7 +311,9 @@ public function testSetValueCamelizesSetterNames() */ public function testSetValueThrowsExceptionIfGetterIsNotPublic() { - $this->propertyAccessor->setValue(new Author(), 'privateSetter', 'foobar'); + $object = new Author(); + + $this->propertyAccessor->setValue($object, 'privateSetter', 'foobar'); } /** @@ -414,7 +416,9 @@ public function getValidPropertyPaths() */ public function testThrowTypeError() { - $this->propertyAccessor->setValue(new TypeHinted(), 'date', 'This is a string, \DateTime expected.'); + $object = new TypeHinted(); + + $this->propertyAccessor->setValue($object, 'date', 'This is a string, \DateTime expected.'); } public function testSetTypeHint() From 8d4f35d12cc660bb5bc6d7a3955ad3fd953913d2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 29 May 2016 12:13:06 +0200 Subject: [PATCH 53/79] [Routing] Finish annotation loader taking a class constant as a beginning of a class name --- .../Routing/Loader/AnnotationFileLoader.php | 21 ++++++++++++++++--- .../Fixtures/AnnotatedClasses/FooTrait.php | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 7e424fd336c5c..b8fc03615f968 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -96,8 +96,6 @@ protected function findClass($file) $token = $tokens[$i]; if (!isset($token[1])) { - $class = false; - continue; } @@ -114,7 +112,24 @@ protected function findClass($file) } if (T_CLASS === $token[0]) { - $class = true; + // Skip usage of ::class constant + $isClassConstant = false; + for ($j = $i - 1; $j > 0; --$j) { + if (!isset($tokens[$j][1])) { + break; + } + + if (T_DOUBLE_COLON === $tokens[$j][0]) { + $isClassConstant = true; + break; + } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { + break; + } + } + + if (!$isClassConstant) { + $class = true; + } } if (T_NAMESPACE === $token[0]) { diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php index f34c6b64cf431..ee8f4b071a368 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php @@ -10,4 +10,4 @@ public function doBar() if (true) { } } -} \ No newline at end of file +} From 142b1a4b468505c4a6bdd44625c959fc2dfebf27 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 29 May 2016 12:39:28 +0200 Subject: [PATCH 54/79] force enabling the external XML entity loaders --- .../DependencyInjection/Loader/XmlFileLoader.php | 2 ++ .../Tests/Loader/XmlFileLoaderTest.php | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index f324aa969cc33..076f4fa659c26 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -333,7 +333,9 @@ public function validateSchema(\DOMDocument $dom) EOF ; + $disableEntities = libxml_disable_entity_loader(false); $valid = @$dom->schemaValidateSource($source); + libxml_disable_entity_loader($disableEntities); foreach ($tmpfiles as $tmpfile) { @unlink($tmpfile); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index a8f8f35133ae5..d2e2a684a86f8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -83,6 +83,19 @@ public function testParseFile() $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\SimpleXMLElement', $xml, '->parseFile() returns an SimpleXMLElement object'); } + public function testLoaderTurnsOnEntityLoaderIfNecessary() + { + $oldValue = libxml_disable_entity_loader(true); + + $containerBuilder = new ContainerBuilder(); + $loader = new XmlFileLoader($containerBuilder, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services2.xml'); + + libxml_disable_entity_loader($oldValue); + + $this->assertTrue(count($containerBuilder->getParameterBag()->all()) > 0, 'Parameters can be read from the config file.'); + } + public function testLoadParameters() { $container = new ContainerBuilder(); From 1c94fea42f6c3d74471597c8b81cbee4959b0934 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 26 May 2016 10:39:15 +0200 Subject: [PATCH 55/79] [Console] SymfonyStyle: Fix alignment/prefixing of multi-line comments CS Fixes Add tests Add docblock Fix side effect on FrameworkBundle tests Remove useless '\n' from TextDescriptor since comments are block --- .../Console/Descriptor/TextDescriptor.php | 2 +- .../Tests/Fixtures/Descriptor/alias_1.txt | 4 +++- .../Tests/Fixtures/Descriptor/alias_2.txt | 4 +++- .../Component/Console/Style/SymfonyStyle.php | 12 +++++++----- .../Style/SymfonyStyle/command/command_11.php | 13 +++++++++++++ .../Style/SymfonyStyle/output/output_11.txt | 6 ++++++ .../Fixtures/Style/SymfonyStyle/output/output_5.txt | 7 +++++-- 7 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index dca8ffc4839ee..4aa00a85dbb17 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -339,7 +339,7 @@ protected function describeContainerDefinition(Definition $definition, array $op */ protected function describeContainerAlias(Alias $alias, array $options = array()) { - $options['output']->comment(sprintf("This service is an alias for the service %s\n", (string) $alias)); + $options['output']->comment(sprintf('This service is an alias for the service %s', (string) $alias)); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.txt index c3b9987ec27f5..91ed6790f03b7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.txt @@ -1 +1,3 @@ -// This service is an alias for the service service_1 \ No newline at end of file + + // This service is an alias for the service service_1 + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt index b53b090b5f3c9..1ebffe38ac58a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt @@ -1 +1,3 @@ -// This service is an alias for the service service_2 \ No newline at end of file + + // This service is an alias for the service service_2 + diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index ebaa18dd536ec..53a7951e016d7 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -170,16 +170,18 @@ public function text($message) } /** - * {@inheritdoc} + * Formats a command comment. + * + * @param string|array $message */ public function comment($message) { - $this->autoPrependText(); - $messages = is_array($message) ? array_values($message) : array($message); - foreach ($messages as $message) { - $this->writeln(sprintf(' // %s', $message)); + foreach ($messages as &$message) { + $message = $this->getFormatter()->format($message); } + + $this->block($messages, null, null, ' // '); } /** diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php new file mode 100644 index 0000000000000..a2781ddbeafa4 --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php @@ -0,0 +1,13 @@ +comment( + 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum' + ); +}; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt new file mode 100644 index 0000000000000..9983af832aa7d --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt @@ -0,0 +1,6 @@ + + // Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + // aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + // Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + // sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt index 738eb9e606010..be4a2db605795 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt @@ -11,5 +11,8 @@ Lorem ipsum dolor sit amet consectetur adipiscing elit Lorem ipsum dolor sit amet - // Lorem ipsum dolor sit amet - // consectetur adipiscing elit + + // Lorem ipsum dolor sit amet + // + // consectetur adipiscing elit + From 7d78196d0c25188eb3c16c9f0fc7cfa2706612c7 Mon Sep 17 00:00:00 2001 From: Anton Bakai Date: Tue, 24 May 2016 23:58:05 +0300 Subject: [PATCH 56/79] Fix for #18843 --- src/Symfony/Component/Yaml/Dumper.php | 2 +- src/Symfony/Component/Yaml/Inline.php | 30 +++++++++++++++---- .../Component/Yaml/Tests/InlineTest.php | 20 +++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index 21351a5c34fc9..9bd9389c07483 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -58,7 +58,7 @@ public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = if ($inline <= 0 || !is_array($input) || empty($input)) { $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); } else { - $isAHash = array_keys($input) !== range(0, count($input) - 1); + $isAHash = Inline::isHash($input); foreach ($input as $key => $value) { $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 5f15e3c5b4a9b..0ce1ced7d7ab8 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -145,6 +145,28 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp } } + /** + * Check if given array is hash or just normal indexed array. + * + * @internal + * + * @param array $value The PHP array to check + * + * @return bool true if value is hash array, false otherwise + */ + public static function isHash(array $value) + { + $expectedKey = 0; + + foreach ($value as $key => $val) { + if ($key !== $expectedKey++) { + return true; + } + } + + return false; + } + /** * Dumps a PHP array to a YAML string. * @@ -157,11 +179,7 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport) { // array - $keys = array_keys($value); - $keysCount = count($keys); - if ((1 === $keysCount && '0' == $keys[0]) - || ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2) - ) { + if ($value && !self::isHash($value)) { $output = array(); foreach ($value as $val) { $output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport); @@ -170,7 +188,7 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor return sprintf('[%s]', implode(', ', $output)); } - // mapping + // hash $output = array(); foreach ($value as $key => $val) { $output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport)); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 255928d16d2cd..b1263d8d290bb 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -169,6 +169,24 @@ public function testParseUnquotedAsteriskFollowedByAComment() Inline::parse('{ foo: * #foo }'); } + /** + * @dataProvider getDataForIsHash + */ + public function testIsHash($array, $expected) + { + $this->assertSame($expected, Inline::isHash($array)); + } + + public function getDataForIsHash() + { + return array( + array(array(), false), + array(array(1, 2, 3), false), + array(array(2 => 1, 1 => 2, 0 => 3), true), + array(array('foo' => 1, 'bar' => 2), true), + ); + } + protected function getTestsForParse() { return array( @@ -296,6 +314,8 @@ protected function getTestsForDump() '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container'), + + '{ foo: { bar: { 1: 2, baz: 3 } } }' => array('foo' => array('bar' => array(1 => 2, 'baz' => 3))), ); } } From b73400d70777ea4179230ada751bfd461b467310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Tue, 24 May 2016 11:36:46 +0100 Subject: [PATCH 57/79] [Serializer] Add missing @throws annotations --- src/Symfony/Component/Serializer/Encoder/ChainDecoder.php | 2 +- .../Component/Serializer/Encoder/DecoderInterface.php | 4 ++++ .../Component/Serializer/Encoder/EncoderInterface.php | 4 ++++ src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | 2 ++ .../Serializer/Normalizer/DenormalizableInterface.php | 6 ++++++ .../Serializer/Normalizer/DenormalizerInterface.php | 4 ++++ .../Serializer/Normalizer/NormalizableInterface.php | 4 ++++ .../Component/Serializer/Normalizer/NormalizerInterface.php | 4 ++++ src/Symfony/Component/Serializer/Serializer.php | 4 ++++ src/Symfony/Component/Serializer/SerializerInterface.php | 6 ++++++ 10 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php index f8f17b4f723e6..352ba584a7638 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php @@ -59,7 +59,7 @@ public function supportsDecoding($format) * * @return DecoderInterface * - * @throws RuntimeException if no decoder is found + * @throws RuntimeException If no decoder is found. */ private function getDecoder($format) { diff --git a/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php b/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php index be788ee7c51ff..3b3e478e7b494 100644 --- a/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php +++ b/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer\Encoder; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the interface of decoders. * @@ -30,6 +32,8 @@ interface DecoderInterface * are encouraged to document which formats they support in a non-inherited * phpdoc comment. * + * @throws Exception + * * @return mixed */ public function decode($data, $format, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php index 1ac6a17180247..662a087ad4284 100644 --- a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php +++ b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer\Encoder; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the interface of encoders. * @@ -25,6 +27,8 @@ interface EncoderInterface * @param string $format Format name * @param array $context options that normalizers/encoders have access to. * + * @throws Exception + * * @return string|bool|int|float|null */ public function encode($data, $format, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 6a2b5cf452dde..247cb9382b917 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -399,6 +399,8 @@ private function needsCdataWrapping($val) * @param \DOMNode $node * @param mixed $val * + * @throws UnexpectedValueException + * * @return bool */ private function selectNodeType(\DOMNode $node, $val) diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 55c030c7c4fa7..b3bbf50a6db91 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer\Normalizer; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the most basic interface a class must implement to be denormalizable. * @@ -33,6 +35,10 @@ interface DenormalizableInterface * @param string|null $format The format is optionally given to be able to denormalize differently * based on different input formats. * @param array $context options for denormalizing + * + * @throws Exception + * + * @return object */ public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); } diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php index 8b6c2333958fe..40c5890bd35ea 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer\Normalizer; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the interface of denormalizers. * @@ -26,6 +28,8 @@ interface DenormalizerInterface * @param string $format format the given data was extracted from * @param array $context options available to the denormalizer * + * @throws Exception + * * @return object */ public function denormalize($data, $class, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php index 79cba123fffb3..9f323b9d0c2a9 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer\Normalizer; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the most basic interface a class must implement to be normalizable. * @@ -33,6 +35,8 @@ interface NormalizableInterface * based on different output formats. * @param array $context Options for normalizing this object * + * @throws Exception + * * @return array|string|bool|int|float|null */ public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index 2a51d631b1624..0ce5b3aef2520 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer\Normalizer; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the interface of normalizers. * @@ -25,6 +27,8 @@ interface NormalizerInterface * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * + * @throws Exception + * * @return array|string|bool|int|float|null */ public function normalize($object, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index c3e07e821c023..6160b5205cde5 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -169,6 +169,8 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} + * + * @throws RuntimeException */ private function getNormalizer($data, $format = null) { @@ -183,6 +185,8 @@ private function getNormalizer($data, $format = null) /** * {@inheritdoc} + * + * @throws RuntimeException */ private function getDenormalizer($data, $type, $format = null) { diff --git a/src/Symfony/Component/Serializer/SerializerInterface.php b/src/Symfony/Component/Serializer/SerializerInterface.php index c79db91892075..ed2e71c2cd03f 100644 --- a/src/Symfony/Component/Serializer/SerializerInterface.php +++ b/src/Symfony/Component/Serializer/SerializerInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Serializer; +use Symfony\Component\Serializer\Exception\Exception; + /** * Defines the interface of the Serializer. * @@ -25,6 +27,8 @@ interface SerializerInterface * @param string $format format name * @param array $context options normalizers/encoders have access to * + * @throws Exception + * * @return string */ public function serialize($data, $format, array $context = array()); @@ -37,6 +41,8 @@ public function serialize($data, $format, array $context = array()); * @param string $format * @param array $context * + * @throws Exception + * * @return object */ public function deserialize($data, $type, $format, array $context = array()); From 893cf00a52ed1f35f06d41e06b575be776fdc17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Thu, 12 May 2016 17:11:08 +0200 Subject: [PATCH 58/79] Catch \Throwable --- .../Bundle/FrameworkBundle/Routing/DelegatingLoader.php | 5 ++++- .../WebProfilerBundle/Controller/ProfilerController.php | 5 +++-- src/Symfony/Component/Config/Loader/FileLoader.php | 3 +++ src/Symfony/Component/DependencyInjection/Container.php | 5 +++++ .../Component/DependencyInjection/ContainerBuilder.php | 4 ++++ .../DependencyInjection/ContainerAwareHttpKernel.php | 5 +++++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php index b37bee83d401c..801149372af99 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php @@ -77,6 +77,9 @@ public function load($resource, $type = null) } catch (\Exception $e) { $this->loading = false; throw $e; + } catch (\Throwable $e) { + $this->loading = false; + throw $e; } $this->loading = false; @@ -85,7 +88,7 @@ public function load($resource, $type = null) if ($controller = $route->getDefault('_controller')) { try { $controller = $this->parser->parse($controller); - } catch (\Exception $e) { + } catch (\InvalidArgumentException $e) { // unable to optimize unknown notation } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 173616fd9f500..a152313df9899 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -18,6 +18,7 @@ use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager; +use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** @@ -193,8 +194,8 @@ public function toolbarAction(Request $request, $token) $url = null; try { $url = $this->generator->generate('_profiler', array('token' => $token)); - } catch (\Exception $e) { - // the profiler is not enabled + } catch (RouteNotFoundException $e) { + // the named route doesn't exist => the profiler is not enabled } return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array( diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index 9c1b4d9f1eaf6..f25d477069e51 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -108,6 +108,9 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe } catch (\Exception $e) { unset(self::$loading[$resource]); throw $e; + } catch (\Throwable $e) { + unset(self::$loading[$resource]); + throw $e; } unset(self::$loading[$resource]); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 9243b66c8e421..084c4da6fef7f 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -320,6 +320,11 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE return; } + throw $e; + } catch (\Throwable $e) { + unset($this->loading[$id]); + unset($this->services[$id]); + throw $e; } diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index ad2f89ae77d0d..7c60f0a7d42bb 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -461,6 +461,10 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV return; } + throw $e; + } catch (\Throwable $e) { + unset($this->loading[$id]); + throw $e; } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php b/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php index c9b8a211d4291..e288720b977b9 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php @@ -64,6 +64,11 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ $this->container->set('request', null, 'request'); $this->container->leaveScope('request'); + throw $e; + } catch (\Throwable $e) { + $this->container->set('request', null, 'request'); + $this->container->leaveScope('request'); + throw $e; } From 6f3673364e9bdd8ae96a7b242310e4931dbe68ad Mon Sep 17 00:00:00 2001 From: Robert Meijers Date: Thu, 26 May 2016 16:08:43 +0200 Subject: [PATCH 59/79] [DependencyInjection] Skip deep reference check for 'service_container' Deep checks on whether a service references another service need to exclude the 'service_container' service as it doesn't exist. Without this dumping the container will fail if a service definition references an inlined service which has a direct or indirect dependency to the service_container. --- .../DependencyInjection/Dumper/PhpDumper.php | 2 +- .../Tests/Dumper/PhpDumperTest.php | 11 ++++ .../Tests/Fixtures/php/services13.php | 54 +++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index d239b7d7d509e..d7ab4fc2b83fe 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1173,7 +1173,7 @@ private function hasReference($id, array $arguments, $deep = false, &$visited = return true; } - if ($deep && !isset($visited[(string) $argument])) { + if ($deep && !isset($visited[(string) $argument]) && 'service_container' !== (string) $argument) { $visited[(string) $argument] = true; $service = $this->container->getDefinition((string) $argument); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 311026c5e62d5..219ea63e82fd5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -226,4 +226,15 @@ public function testCircularReference() $dumper = new PhpDumper($container); $dumper->dump(); } + + public function testInlinedDefinitionReferencingServiceContainer() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addMethodCall('add', array(new Reference('service_container')))->setPublic(false); + $container->register('bar', 'stdClass')->addArgument(new Reference('foo')); + $container->compile(); + + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php new file mode 100644 index 0000000000000..0c33b7b3eab8d --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php @@ -0,0 +1,54 @@ +services = + $this->scopedServices = + $this->scopeStacks = array(); + $this->scopes = array(); + $this->scopeChildren = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + ); + + $this->aliases = array(); + } + + /** + * Gets the 'bar' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getBarService() + { + $a = new \stdClass(); + $a->add($this); + + return $this->services['bar'] = new \stdClass($a); + } +} From b3cd2679b861a249f31253ed6e67187190fb25cc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 30 May 2016 10:16:24 +0200 Subject: [PATCH 60/79] Partial revert of previous PR --- .../WebProfilerBundle/Controller/ProfilerController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index a152313df9899..173616fd9f500 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -18,7 +18,6 @@ use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager; -use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** @@ -194,8 +193,8 @@ public function toolbarAction(Request $request, $token) $url = null; try { $url = $this->generator->generate('_profiler', array('token' => $token)); - } catch (RouteNotFoundException $e) { - // the named route doesn't exist => the profiler is not enabled + } catch (\Exception $e) { + // the profiler is not enabled } return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array( From 91635a805480bf635c9ef2aa7243c17b25524742 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 30 May 2016 10:31:06 +0200 Subject: [PATCH 61/79] Revert "bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)" This reverts commit 44f6f893083831ce9845c7d27c5e2cc855e0100b, reversing changes made to 57d6053822866a56be7d7ea1db61a69390dcc528. --- .../DependencyInjection/Loader/XmlFileLoader.php | 2 -- .../Tests/Loader/XmlFileLoaderTest.php | 13 ------------- 2 files changed, 15 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 076f4fa659c26..f324aa969cc33 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -333,9 +333,7 @@ public function validateSchema(\DOMDocument $dom) EOF ; - $disableEntities = libxml_disable_entity_loader(false); $valid = @$dom->schemaValidateSource($source); - libxml_disable_entity_loader($disableEntities); foreach ($tmpfiles as $tmpfile) { @unlink($tmpfile); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index d2e2a684a86f8..a8f8f35133ae5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -83,19 +83,6 @@ public function testParseFile() $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\SimpleXMLElement', $xml, '->parseFile() returns an SimpleXMLElement object'); } - public function testLoaderTurnsOnEntityLoaderIfNecessary() - { - $oldValue = libxml_disable_entity_loader(true); - - $containerBuilder = new ContainerBuilder(); - $loader = new XmlFileLoader($containerBuilder, new FileLocator(self::$fixturesPath.'/xml')); - $loader->load('services2.xml'); - - libxml_disable_entity_loader($oldValue); - - $this->assertTrue(count($containerBuilder->getParameterBag()->all()) > 0, 'Parameters can be read from the config file.'); - } - public function testLoadParameters() { $container = new ContainerBuilder(); From 7d8dc87616b5fe291967dd8c09cdd1dd422df517 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 30 May 2016 10:40:50 +0200 Subject: [PATCH 62/79] updated CHANGELOG for 2.3.42 --- CHANGELOG-2.3.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index 1d8ff9479ecca..2758f011f3cfd 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,22 @@ in 2.3 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/v2.3.0...v2.3.1 +* 2.3.42 (2016-05-30) + + * bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh) + * bug #18893 [DependencyInjection] Skip deep reference check for 'service_container' (RobertMe) + * bug #18812 Catch \Throwable (fprochazka) + * bug #18821 [Form] Removed UTC specification with timestamp (francisbesset) + * bug #18861 Fix for #18843 (inso) + * bug #18907 [Routing] Fix the annotation loader taking a class constant as a beginning of a class name (jakzal, nicolas-grekas) + * bug #18864 [Console][DX] Fixed ambiguous error message when using a duplicate option shortcut (peterrehm) + * bug #18844 [Yaml] fix exception contexts (xabbuh) + * bug #18840 [Yaml] properly handle unindented collections (xabbuh) + * bug #18839 People - person singularization (Keeo) + * bug #18828 [Yaml] chomp newlines only at the end of YAML documents (xabbuh) + * bug #18635 [Console] Prevent fatal error when calling Command::getHelper without helperSet (chalasr) + * bug #18761 [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper (issei-m) + * 2.3.41 (2016-05-09) * security #18733 limited the maximum length of a submitted username (fabpot) From b4a9d258814792a89d8379975bcb14e7d2ef2914 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 30 May 2016 10:40:59 +0200 Subject: [PATCH 63/79] update CONTRIBUTORS for 2.3.42 --- CONTRIBUTORS.md | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d8e08d87119b7..94711183ff113 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -23,8 +23,8 @@ Symfony is the result of the work of many people who made the code better - Pascal Borreli (pborreli) - Joseph Bielawski (stloyd) - Wouter De Jong (wouterj) - - Karma Dordrak (drak) - Romain Neutron (romain) + - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - Jeremy Mikola (jmikola) @@ -53,11 +53,11 @@ Symfony is the result of the work of many people who made the code better - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Kevin Bond (kbond) + - Peter Rehm (rpet) - Gábor Egyed (1ed) - Michel Weimerskirch (mweimerskirch) - Eric Clemmons (ericclemmons) - Andrej Hudec (pulzarraider) - - Peter Rehm (rpet) - Christian Raue - Matthias Pigulla (mpdude) - Deni @@ -67,6 +67,7 @@ Symfony is the result of the work of many people who made the code better - Iltar van der Berg (kjarli) - Ener-Getick (energetick) - Douglas Greenshields (shieldo) + - Charles Sarrazin (csarrazi) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) @@ -74,7 +75,6 @@ Symfony is the result of the work of many people who made the code better - Pierre du Plessis (pierredup) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - - Charles Sarrazin (csarrazi) - John Wards (johnwards) - Toni Uebernickel (havvg) - Fran Moreno (franmomu) @@ -89,6 +89,7 @@ Symfony is the result of the work of many people who made the code better - Alexander M. Turek (derrabus) - Dariusz Ruminski - marc.weistroff + - Issei Murasawa (issei_m) - lenar - Włodzimierz Gajda (gajdaw) - Alexander Schwenn (xelaris) @@ -97,13 +98,12 @@ Symfony is the result of the work of many people who made the code better - Colin Frei - Adrien Brault (adrienbrault) - Joshua Thijssen - - Issei Murasawa (issei_m) + - Baptiste Clavié (talus) - Peter Kokot (maastermedia) - excelwebzone - Jacob Dreesen (jdreesen) - Jérémy DERUSSÉ (jderusse) - Vladimir Reznichenko (kalessil) - - Baptiste Clavié (talus) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) - David Buchmann (dbu) @@ -121,6 +121,7 @@ Symfony is the result of the work of many people who made the code better - Evgeniy (ewgraf) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) + - Titouan Galopin (tgalopin) - Jérémie Augustin (jaugustin) - Sebastiaan Stok (sstok) - Tugdual Saunier (tucksaun) @@ -129,10 +130,10 @@ Symfony is the result of the work of many people who made the code better - Arnaud Kleinpeter (nanocom) - Joel Wurtz (brouznouf) - Philipp Wahala (hifi) - - Titouan Galopin (tgalopin) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Vincent AUBERT (vincent) + - Rouven Weßling (realityking) - Mikael Pajunen - Clemens Tolboom - Helmer Aaviksoo @@ -143,7 +144,6 @@ Symfony is the result of the work of many people who made the code better - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba - - Rouven Weßling (realityking) - Warnar Boekkooi (boekkooi) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) @@ -211,6 +211,7 @@ Symfony is the result of the work of many people who made the code better - Kristen Gilden (kgilden) - Dawid Nowak - Pierre-Yves LEBECQ (pylebecq) + - Daniel Espendiller - Jakub Kucharovic (jkucharovic) - Eugene Leonovich (rybakit) - Filippo Tessarotto @@ -240,7 +241,6 @@ Symfony is the result of the work of many people who made the code better - Michael Holm (hollo) - Marc Weistroff (futurecat) - Hidde Wieringa (hiddewie) - - Daniel Espendiller - Chris Smith (cs278) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) @@ -293,6 +293,7 @@ Symfony is the result of the work of many people who made the code better - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) + - Christian Schmidt - François-Xavier de Guillebon (de-gui_f) - Damien Alexandre (damienalexandre) - Felix Labrecque @@ -309,6 +310,7 @@ Symfony is the result of the work of many people who made the code better - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) - Greg Thornton (xdissent) + - Robin Chalas (chalas_r) - Costin Bereveanu (schniper) - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) @@ -319,12 +321,14 @@ Symfony is the result of the work of many people who made the code better - Pavel Volokitin (pvolok) - Endre Fejes - Tobias Naumann (tna) + - Daniel Beyer - Shein Alexey - Baptiste Lafontaine - Joe Lencioni - Daniel Tschinder - Kai - Lee Rowlands + - Krzysztof Piasecki (krzysztek) - Maximilian Reichel (phramz) - Loick Piera (pyrech) - Karoly Negyesi (chx) @@ -364,7 +368,6 @@ Symfony is the result of the work of many people who made the code better - EdgarPE - Florian Pfitzer (marmelatze) - Asier Illarramendi (doup) - - Christian Schmidt - Chris Sedlmayr (catchamonkey) - Seb Koelen - Christoph Mewes (xrstf) @@ -382,6 +385,7 @@ Symfony is the result of the work of many people who made the code better - Mathieu Lemoine - franek (franek) - Christian Wahler + - Mathieu Lemoine - Gintautas Miselis - Zander Baldwin - Adam Harvey @@ -419,7 +423,6 @@ Symfony is the result of the work of many people who made the code better - Anthony Ferrara - Ioan Negulescu - Jakub Škvára (jskvara) - - Daniel Beyer - Andrew Udvare (audvare) - alexpods - Tristan Darricau (nicofuma) @@ -448,6 +451,7 @@ Symfony is the result of the work of many people who made the code better - Denis Gorbachev (starfall) - Peter van Dommelen - Tim van Densen + - Martin Morávek (keeo) - Steven Surowiec - Kevin Saliou (kbsali) - NothingWeAre @@ -462,7 +466,6 @@ Symfony is the result of the work of many people who made the code better - Ziumin - Jeremy Benoist - Lenar Lõhmus - - Krzysztof Piasecki (krzysztek) - Benjamin Laugueux (yzalis) - Zach Badgett (zachbadgett) - Aurélien Fredouelle @@ -501,6 +504,7 @@ Symfony is the result of the work of many people who made the code better - Javier López (loalf) - Reinier Kip - Dustin Dobervich (dustin10) + - dantleech - Anne-Sophie Bachelard (annesophie) - Sebastian Marek (proofek) - Erkhembayar Gantulga (erheme318) @@ -563,6 +567,7 @@ Symfony is the result of the work of many people who made the code better - Peter Ward - Dominik Ritter (dritter) - Sebastian Grodzicki (sgrodzicki) + - SpacePossum - Martin Hujer (martinhujer) - Pascal Helfenstein - Baldur Rensch (brensch) @@ -613,6 +618,7 @@ Symfony is the result of the work of many people who made the code better - Adrien Lucas (adrienlucas) - James Michael DuPont - Tom Klingenberg + - Filip Procházka (fprochazka) - Christopher Hall (mythmakr) - Paul Kamer (pkamer) - Rafał Wrzeszcz (rafalwrzeszcz) @@ -629,6 +635,7 @@ Symfony is the result of the work of many people who made the code better - Alaattin Kahramanlar (alaattin) - Maksim Kotlyar (makasim) - Neil Ferreira + - Nathanael Noblet (gnat) - Dmitry Parnas (parnas) - Théo FIDRY (theofidry) - Paul LE CORRE @@ -745,7 +752,6 @@ Symfony is the result of the work of many people who made the code better - Guillaume Royer - Artem (digi) - boite - - dantleech - Vadim Tyukov (vatson) - Sortex - chispita @@ -851,6 +857,7 @@ Symfony is the result of the work of many people who made the code better - Christian Sciberras - Anton Bakai - Clement Herreman (clemherreman) + - Dan Ionut Dumitriu (danionut90) - Nyro (nyro) - Marco - Marc Torres @@ -870,7 +877,6 @@ Symfony is the result of the work of many people who made the code better - ConneXNL - Aharon Perkel - Abdul.Mohsen B. A. A - - SpacePossum - Benoît Burnichon - Remi Collet - pthompson @@ -1059,6 +1065,7 @@ Symfony is the result of the work of many people who made the code better - stloyd - Chris Tickner - Andrew Coulton + - Jeremy Benoist - Michal Gebauer - Gleb Sidora - David Stone @@ -1108,7 +1115,6 @@ Symfony is the result of the work of many people who made the code better - Simon Sargeant - efeen - Michał Dąbrowski (defrag) - - Nathanael Noblet (gnat) - Simone Fumagalli (hpatoio) - Brian Graham (incognito) - Kevin Vergauwen (innocenzo) @@ -1214,8 +1220,10 @@ Symfony is the result of the work of many people who made the code better - Alan Chen - Maerlyn - Even André Fiskvik + - Erik van Wingerden - Dane Powell - Gerrit Drost + - Linnaea Von Lavia - Lenar Lõhmus - Cristian Gonzalez - AlberT @@ -1271,6 +1279,7 @@ Symfony is the result of the work of many people who made the code better - Joseph Deray - Damian Sromek - Ben + - dasmfm - Arnaud Buathier (arnapou) - chesteroni (chesteroni) - Mauricio Lopez (diaspar) @@ -1358,7 +1367,6 @@ Symfony is the result of the work of many people who made the code better - Norman Soetbeer - zorn - Benjamin Long - - Robin Chalas - Matt Janssen - Peter Gribanov - kwiateusz @@ -1443,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better - ollie harridge (ollietb) - Paul Andrieux (paulandrieux) - Paweł Szczepanek (pauluz) + - Philippe Degeeter (pdegeeter) - Christian López Espínola (penyaskito) - Petr Jaroš (petajaros) - Philipp Hoffmann (philipphoffmann) From 7143b2974cc2b47542df987901db0e2eda33a8d5 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 30 May 2016 10:41:10 +0200 Subject: [PATCH 64/79] updated VERSION for 2.3.42 --- 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 85df657668bff..7f4823220c075 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.42-DEV'; + const VERSION = '2.3.42'; const VERSION_ID = 20342; const MAJOR_VERSION = 2; const MINOR_VERSION = 3; const RELEASE_VERSION = 42; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From c0b9e9950a55e668fcd5a9d0d0977baadca59d99 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 31 May 2016 21:30:07 +0200 Subject: [PATCH 65/79] document method name changes in Voter class --- UPGRADE-3.0.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 265724627c2ae..08796bd419d29 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1040,6 +1040,39 @@ UPGRADE FROM 2.x to 3.0 } ``` + * The `AbstractVoter::isGranted()` method has been replaced by `Voter::voteOnAttribute()`. + + Before: + + ```php + class MyVoter extends AbstractVoter + { + protected function isGranted($attribute, $object, $user = null) + { + return 'EDIT' === $attribute && $user === $object->getAuthor(); + } + + // ... + } + ``` + + After: + + ```php + class MyVoter extends Voter + { + protected function voteOnAttribute($attribute, $object, TokenInterface $token) + { + return 'EDIT' === $attribute && $token->getUser() === $object->getAuthor(); + } + + // ... + } + ``` + + * The `supportsAttribute()` and `supportsClass()` methods of the `AuthenticatedVoter`, `ExpressionVoter`, + and `RoleVoter` classes have been removed. + * The `intention` option was renamed to `csrf_token_id` for all the authentication listeners. * The `csrf_provider` option was renamed to `csrf_token_generator` for all the authentication listeners. From c1df9f210e53a9155343159a820e320a76d35582 Mon Sep 17 00:00:00 2001 From: Dword123 Date: Wed, 1 Jun 2016 13:20:21 +0200 Subject: [PATCH 66/79] Improve memory efficiency This avoids concatenating `$message` and `PHP_EOL` (if necessary) as a new value, greatly improving memory efficiency for large `$message`s. --- src/Symfony/Component/Console/Output/StreamOutput.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 80c352a278671..f3708ecffe526 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -70,7 +70,7 @@ public function getStream() */ protected function doWrite($message, $newline) { - if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) { + if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { // should never happen throw new \RuntimeException('Unable to write output.'); } From 71dcaa14c927d84ff2ed5d88e76fe55f5454e807 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 1 Jun 2016 21:19:49 +0200 Subject: [PATCH 67/79] Add 3.1 to PR template branch row, remove 2.3 --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7ed7b20e228ae..71c775edb8ae7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | "master" for new features / 2.3, 2.7, 2.8 or 3.0 for fixes +| Branch? | "master" for new features / 2.7, 2.8, 3.0 or 3.1 for fixes | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no From e041da09e45960e941e39ae1ee744f287f85e251 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 2 Jun 2016 08:29:41 +0200 Subject: [PATCH 68/79] Use the Trusty Travis infrastructure for HHVM builds This allows running an uptodate version of HHVM rather than running the latest version supporting Precise, which is very old. --- .travis.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a48fa8a353035..1011535020f30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,11 @@ env: matrix: include: + # Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version - php: hhvm + sudo: required + dist: trusty + group: edge - php: 5.3 - php: 5.4 - php: 5.5 @@ -37,10 +41,10 @@ services: mongodb before_install: - PHP=$TRAVIS_PHP_VERSION # Matrix lines for intermediate PHP versions are skipped for pull requests - - if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && $PHP != hhvm && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi + - if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi # A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line - if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi - - if [[ $PHP != hhvm ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi + - if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi - if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi - if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi @@ -49,8 +53,8 @@ before_install: - if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi - if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi - if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi - - if [[ ! $skip && $PHP != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi - - if [[ ! $skip && $PHP != hhvm ]]; then phpenv config-rm xdebug.ini; fi + - if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi + - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini; fi - if [[ ! $skip ]]; then composer self-update --stable; fi - if [[ ! $skip ]]; then cp .composer/* ~/.composer/; fi - if [[ ! $skip ]]; then ./phpunit install; fi @@ -68,7 +72,7 @@ install: - export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev - if [[ ! $deps ]]; then composer update; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi - if [[ $TRAVIS_BRANCH = master ]]; then export SYMFONY_PHPUNIT_OVERLOAD=1; fi - - if [[ $PHP != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi + - if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi script: - if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi From e6956c9bfc25d892107648f005850582d289c6f0 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 2 Jun 2016 10:18:15 +0200 Subject: [PATCH 69/79] Skip some tests on HHVM due to a PHPunit bug --- .../Storage/Handler/MemcacheSessionHandlerTest.php | 4 ++++ .../Storage/Handler/MemcachedSessionHandlerTest.php | 4 ++++ .../Session/Storage/Handler/PdoSessionHandlerTest.php | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index e8795244b176e..0c579d7724846 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -30,6 +30,10 @@ class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); + } + parent::setUp(); $this->memcache = $this->getMock('Memcache'); $this->storage = new MemcacheSessionHandler( diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index f51ec8ed63c86..75e4a20e2a8d5 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -31,6 +31,10 @@ class MemcachedSessionHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); + } + parent::setUp(); if (version_compare(phpversion('memcached'), '2.2.0', '>=')) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 1af321096ebad..9612320976944 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -135,6 +135,10 @@ public function testReadWriteReadWithNullByte() public function testReadConvertsStreamToString() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); + } + $pdo = new MockPdo('pgsql'); $pdo->prepareResult = $this->getMock('PDOStatement'); @@ -152,6 +156,10 @@ public function testReadConvertsStreamToString() public function testReadLockedConvertsStreamToString() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); + } + $pdo = new MockPdo('pgsql'); $selectStmt = $this->getMock('PDOStatement'); $insertStmt = $this->getMock('PDOStatement'); From 574f4e4147faeb59f0f4da659a80286edbb3fe62 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 3 Jun 2016 09:20:20 +0200 Subject: [PATCH 70/79] [appveyor] Ignore STATUS_HEAP_CORRUPTION errors on Windows --- phpunit | 10 ++++++++-- .../Tests/DataCollector/DumpDataCollectorTest.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/phpunit b/phpunit index 6d66f7b2b252a..3ab3ca1686042 100755 --- a/phpunit +++ b/phpunit @@ -53,6 +53,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ chdir("phpunit-$PHPUNIT_VERSION"); passthru("$COMPOSER remove --no-update phpspec/prophecy"); passthru("$COMPOSER remove --no-update symfony/yaml"); + if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) { + passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); + } passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=3.1@dev\""); passthru("$COMPOSER install --prefer-dist --no-progress --ansi", $exit); if ($exit) { @@ -170,8 +173,11 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) { unlink($file); } - // Fail on any individual component failures but ignore STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) and STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005) on Windows when APCu is enabled - if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !ini_get('apc.enable_cli') || (-1073740791 !== $procStatus && -1073741819 !== $procStatus))) { + // Fail on any individual component failures but ignore some error codes on Windows when APCu is enabled: + // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) + // STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005) + // STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374) + if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !ini_get('apc.enable_cli') || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) { $exit = $procStatus; echo "\033[41mKO\033[0m $component\n\n"; } else { diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index e9b8433c46ef5..8675622891c87 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -128,7 +128,7 @@ public function testFlush() $line = __LINE__ - 1; ob_start(); - $collector = null; + $collector->__destruct(); if (PHP_VERSION_ID >= 50400) { $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean()); } else { From 346149e7c81670b7c839155609680b220afb756b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 3 Jun 2016 10:10:46 +0200 Subject: [PATCH 71/79] [travis] Don't use parallel on HHVM --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1011535020f30..778d0e9c04db2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,7 @@ cache: services: mongodb before_install: + - stty cols 120 - PHP=$TRAVIS_PHP_VERSION # Matrix lines for intermediate PHP versions are skipped for pull requests - if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi @@ -76,8 +77,9 @@ install: script: - if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi - - if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi - - if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi + - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi + - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi + - if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi From cb850fef26af00920ebe5552f636fc9d6715133b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 6 Jun 2016 11:00:08 +0200 Subject: [PATCH 72/79] Fix merge --- .../Component/DependencyInjection/Dumper/PhpDumper.php | 2 +- .../Tests/Fixtures/php/services13.php | 8 ++++++++ .../Component/Serializer/Encoder/XmlEncoder.php | 2 +- .../Serializer/Normalizer/DenormalizableInterface.php | 6 +++--- .../Serializer/Normalizer/DenormalizerInterface.php | 6 +++--- .../Serializer/Normalizer/NormalizableInterface.php | 8 ++++---- .../Serializer/Normalizer/NormalizerInterface.php | 8 ++++---- src/Symfony/Component/Serializer/Serializer.php | 4 ---- .../Component/Serializer/SerializerInterface.php | 10 +++++----- src/Symfony/Component/Yaml/Tests/InlineTest.php | 2 -- 10 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index de8c4dae423d8..aa1257d845c1f 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1268,7 +1268,7 @@ private function hasReference($id, array $arguments, $deep = false, array &$visi return true; } - if ($deep && !isset($visited[$argumentId]) && 'service_container' !== (string) $argument) { + if ($deep && !isset($visited[$argumentId]) && 'service_container' !== $argumentId) { $visited[$argumentId] = true; $service = $this->container->getDefinition($argumentId); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php index 0c33b7b3eab8d..f6038f390367e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php @@ -36,6 +36,14 @@ public function __construct() $this->aliases = array(); } + /** + * {@inheritdoc} + */ + public function compile() + { + throw new LogicException('You cannot compile a dumped frozen container.'); + } + /** * Gets the 'bar' service. * diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 94cff517dc62e..be6688bc3d385 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -461,7 +461,7 @@ private function needsCdataWrapping($val) * @param mixed $val * * @throws UnexpectedValueException - * + * * @return bool */ private function selectNodeType(\DOMNode $node, $val) diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 765a1c6567ed6..b515611e7892e 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\Exception; +use Symfony\Component\Serializer\Exception\ExceptionInterface; /** * Defines the most basic interface a class must implement to be denormalizable. @@ -36,9 +36,9 @@ interface DenormalizableInterface * based on different input formats * @param array $context options for denormalizing * - * @return object + * @throws ExceptionInterface * - * @throws Exception + * @return object */ public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); } diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php index 40c5890bd35ea..a544124f29e21 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\Exception; +use Symfony\Component\Serializer\Exception\ExceptionInterface; /** * Defines the interface of denormalizers. @@ -28,8 +28,8 @@ interface DenormalizerInterface * @param string $format format the given data was extracted from * @param array $context options available to the denormalizer * - * @throws Exception - * + * @throws ExceptionInterface + * * @return object */ public function denormalize($data, $class, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php index b4718cd482d39..ac3edb680dbe6 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\Exception; +use Symfony\Component\Serializer\Exception\ExceptionInterface; /** * Defines the most basic interface a class must implement to be normalizable. @@ -35,9 +35,9 @@ interface NormalizableInterface * based on different output formats. * @param array $context Options for normalizing this object * - * @throws Exception - * - * @return array|string|bool|int|float|null + * @throws ExceptionInterface + * + * @return array|scalar */ public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); } diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index 0ce5b3aef2520..333397044b7b9 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\Exception; +use Symfony\Component\Serializer\Exception\ExceptionInterface; /** * Defines the interface of normalizers. @@ -27,9 +27,9 @@ interface NormalizerInterface * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * - * @throws Exception - * - * @return array|string|bool|int|float|null + * @throws ExceptionInterface + * + * @return array|scalar */ public function normalize($object, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index d95873800ef44..0259bfeda6441 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -183,8 +183,6 @@ public function supportsDenormalization($data, $type, $format = null) * @param string $format format name, present to give the option to normalizers to act differently based on formats * * @return NormalizerInterface|null - * - * @throws RuntimeException */ private function getNormalizer($data, $format) { @@ -203,8 +201,6 @@ private function getNormalizer($data, $format) * @param string $format format name, present to give the option to normalizers to act differently based on formats * * @return DenormalizerInterface|null - * - * @throws RuntimeException */ private function getDenormalizer($data, $class, $format) { diff --git a/src/Symfony/Component/Serializer/SerializerInterface.php b/src/Symfony/Component/Serializer/SerializerInterface.php index ed2e71c2cd03f..7d1fb2e465430 100644 --- a/src/Symfony/Component/Serializer/SerializerInterface.php +++ b/src/Symfony/Component/Serializer/SerializerInterface.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Serializer; -use Symfony\Component\Serializer\Exception\Exception; +use Symfony\Component\Serializer\Exception\ExceptionInterface; /** * Defines the interface of the Serializer. @@ -27,8 +27,8 @@ interface SerializerInterface * @param string $format format name * @param array $context options normalizers/encoders have access to * - * @throws Exception - * + * @throws ExceptionInterface + * * @return string */ public function serialize($data, $format, array $context = array()); @@ -41,8 +41,8 @@ public function serialize($data, $format, array $context = array()); * @param string $format * @param array $context * - * @throws Exception - * + * @throws ExceptionInterface + * * @return object */ public function deserialize($data, $type, $format, array $context = array()); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 1fbd62f56e533..0e03e36a87a8a 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -398,8 +398,6 @@ public function getTestsForDump() array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), - array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), - array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))), ); } From bf3a2c0abd48927ede8d2820c98838762ba6339d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 6 Jun 2016 11:38:47 +0200 Subject: [PATCH 73/79] `@throws` annotations should go after `@return` --- src/Symfony/Bridge/Twig/NodeVisitor/Scope.php | 4 ++-- .../Translation/PhpExtractor.php | 4 ++-- .../TwigBundle/Extension/AssetsExtension.php | 4 ++-- .../Component/CssSelector/Parser/Parser.php | 16 +++++++-------- .../CssSelector/Parser/TokenStream.php | 12 +++++------ .../CssSelector/XPath/Translator.php | 4 ++-- .../EventDispatcher/GenericEvent.php | 8 ++++---- .../Finder/Expression/Expression.php | 4 ++-- src/Symfony/Component/Finder/Finder.php | 4 ++-- src/Symfony/Component/Form/Form.php | 16 +++++++-------- .../HttpFoundation/ResponseHeaderBag.php | 4 ++-- .../Storage/SessionStorageInterface.php | 4 ++-- .../HttpKernel/HttpCache/HttpCache.php | 8 ++++---- src/Symfony/Component/Process/Process.php | 8 ++++---- .../Security/Acl/Dbal/MutableAclProvider.php | 20 +++++++++---------- .../Security/Acl/Domain/ObjectIdentity.php | 4 ++-- .../Security/Acl/Model/AclInterface.php | 4 ++-- .../Acl/Model/MutableAclProviderInterface.php | 4 ++-- .../Security/Acl/Permission/MaskBuilder.php | 4 ++-- .../Serializer/Encoder/XmlEncoder.php | 4 ++-- .../Normalizer/DenormalizableInterface.php | 4 ---- .../Normalizer/DenormalizerInterface.php | 4 ---- .../Normalizer/NormalizableInterface.php | 4 ---- .../Normalizer/NormalizerInterface.php | 4 ---- .../Serializer/SerializerInterface.php | 6 ------ .../Component/Stopwatch/StopwatchEvent.php | 2 -- .../Extractor/AbstractFileExtractor.php | 4 ++-- .../Translation/Loader/XliffFileLoader.php | 3 +-- .../Translation/TranslatorBagInterface.php | 4 ++-- .../Translation/TranslatorInterface.php | 8 ++++---- 30 files changed, 79 insertions(+), 104 deletions(-) diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php index 1712bd5afee8e..f9333bf683d1a 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php @@ -67,9 +67,9 @@ public function leave() * @param string $key * @param mixed $value * - * @throws \LogicException - * * @return Scope Current scope + * + * @throws \LogicException */ public function set($key, $value) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index ca9e7f994c090..cf7f3c5769bf2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -182,9 +182,9 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) /** * @param string $file * - * @throws \InvalidArgumentException - * * @return bool + * + * @throws \InvalidArgumentException */ protected function canBeExtracted($file) { diff --git a/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php b/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php index fc62ef059daaf..976086920e07b 100644 --- a/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php +++ b/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php @@ -95,9 +95,9 @@ public function getName() * * @param string $url The URL that has to be absolute * - * @throws \RuntimeException - * * @return string The absolute URL + * + * @throws \RuntimeException */ private function ensureUrlIsAbsolute($url) { diff --git a/src/Symfony/Component/CssSelector/Parser/Parser.php b/src/Symfony/Component/CssSelector/Parser/Parser.php index 9625e3e8a1100..8b86bce3b77d6 100644 --- a/src/Symfony/Component/CssSelector/Parser/Parser.php +++ b/src/Symfony/Component/CssSelector/Parser/Parser.php @@ -56,9 +56,9 @@ public function parse($source) * * @param Token[] $tokens * - * @throws SyntaxErrorException - * * @return array + * + * @throws SyntaxErrorException */ public static function parseSeries(array $tokens) { @@ -131,9 +131,9 @@ private function parseSelectorList(TokenStream $stream) * * @param TokenStream $stream * - * @throws SyntaxErrorException - * * @return Node\SelectorNode + * + * @throws SyntaxErrorException */ private function parserSelectorNode(TokenStream $stream) { @@ -171,9 +171,9 @@ private function parserSelectorNode(TokenStream $stream) * @param TokenStream $stream * @param bool $insideNegation * - * @throws SyntaxErrorException - * * @return array + * + * @throws SyntaxErrorException */ private function parseSimpleSelector(TokenStream $stream, $insideNegation = false) { @@ -328,9 +328,9 @@ private function parseElementNode(TokenStream $stream) * @param Node\NodeInterface $selector * @param TokenStream $stream * - * @throws SyntaxErrorException - * * @return Node\AttributeNode + * + * @throws SyntaxErrorException */ private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream) { diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index c0525d7a83364..0c166eff229fb 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -83,9 +83,9 @@ public function freeze() /** * Returns next token. * - * @throws InternalErrorException If there is no more token - * * @return Token + * + * @throws InternalErrorException If there is no more token */ public function getNext() { @@ -131,9 +131,9 @@ public function getUsed() /** * Returns nex identifier token. * - * @throws SyntaxErrorException If next token is not an identifier - * * @return string The identifier token value + * + * @throws SyntaxErrorException If next token is not an identifier */ public function getNextIdentifier() { @@ -149,9 +149,9 @@ public function getNextIdentifier() /** * Returns nex identifier or star delimiter token. * - * @throws SyntaxErrorException If next token is not an identifier or a star delimiter - * * @return null|string The identifier token value or null if star found + * + * @throws SyntaxErrorException If next token is not an identifier or a star delimiter */ public function getNextIdentifierOrStar() { diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php index 5053793ea06c9..aac2691f1adfb 100644 --- a/src/Symfony/Component/CssSelector/XPath/Translator.php +++ b/src/Symfony/Component/CssSelector/XPath/Translator.php @@ -266,9 +266,9 @@ public function addPseudoClass(XPathExpr $xpath, $pseudoClass) * @param string $attribute * @param string $value * - * @throws ExpressionErrorException - * * @return XPathExpr + * + * @throws ExpressionErrorException */ public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value) { diff --git a/src/Symfony/Component/EventDispatcher/GenericEvent.php b/src/Symfony/Component/EventDispatcher/GenericEvent.php index 6458180a5aac3..03cbcfe33414e 100644 --- a/src/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/src/Symfony/Component/EventDispatcher/GenericEvent.php @@ -61,9 +61,9 @@ public function getSubject() * * @param string $key Key. * - * @throws \InvalidArgumentException If key is not found. - * * @return mixed Contents of array key. + * + * @throws \InvalidArgumentException If key is not found. */ public function getArgument($key) { @@ -130,9 +130,9 @@ public function hasArgument($key) * * @param string $key Array key. * - * @throws \InvalidArgumentException If key does not exist in $this->args. - * * @return mixed + * + * @throws \InvalidArgumentException If key does not exist in $this->args. */ public function offsetGet($key) { diff --git a/src/Symfony/Component/Finder/Expression/Expression.php b/src/Symfony/Component/Finder/Expression/Expression.php index 900260751ee4e..a4f1f219a8ec2 100644 --- a/src/Symfony/Component/Finder/Expression/Expression.php +++ b/src/Symfony/Component/Finder/Expression/Expression.php @@ -123,9 +123,9 @@ public function isGlob() } /** - * @throws \LogicException - * * @return Glob + * + * @throws \LogicException */ public function getGlob() { diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index a7c7500e09bb8..c83a024eabfd3 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -128,9 +128,9 @@ public function useBestAdapter() * * @param string $name * - * @throws \InvalidArgumentException - * * @return Finder The current Finder instance + * + * @throws \InvalidArgumentException */ public function setAdapter($name) { diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 47c38c5718b06..a395f427087b2 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -1072,9 +1072,9 @@ public function createView(FormView $parent = null) * * @param mixed $value The value to transform * - * @throws TransformationFailedException If the value cannot be transformed to "normalized" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "normalized" format */ private function modelToNorm($value) { @@ -1098,9 +1098,9 @@ private function modelToNorm($value) * * @param string $value The value to reverse transform * - * @throws TransformationFailedException If the value cannot be transformed to "model" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "model" format */ private function normToModel($value) { @@ -1126,9 +1126,9 @@ private function normToModel($value) * * @param mixed $value The value to transform * - * @throws TransformationFailedException If the value cannot be transformed to "view" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "view" format */ private function normToView($value) { @@ -1161,9 +1161,9 @@ private function normToView($value) * * @param string $value The value to reverse transform * - * @throws TransformationFailedException If the value cannot be transformed to "normalized" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "normalized" format */ private function viewToNorm($value) { diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 06534aa75bf39..1d26e86b9b17b 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -181,9 +181,9 @@ public function removeCookie($name, $path = '/', $domain = null) * * @param string $format * - * @throws \InvalidArgumentException When the $format is invalid - * * @return array + * + * @throws \InvalidArgumentException When the $format is invalid */ public function getCookies($format = self::COOKIES_FLAT) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 4b2f5d27aab41..206f18e77f8d9 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -24,9 +24,9 @@ interface SessionStorageInterface /** * Starts the session. * - * @throws \RuntimeException If something goes wrong starting the session. - * * @return bool True if started. + * + * @throws \RuntimeException If something goes wrong starting the session. */ public function start(); diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index 6075d235b6d83..f794d94e29d45 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -153,9 +153,9 @@ public function getKernel() /** * Gets the Surrogate instance. * - * @throws \LogicException - * * @return SurrogateInterface A Surrogate instance + * + * @throws \LogicException */ public function getSurrogate() { @@ -169,10 +169,10 @@ public function getSurrogate() /** * Gets the Esi instance. * - * @throws \LogicException - * * @return Esi An Esi instance * + * @throws \LogicException + * * @deprecated since version 2.6, to be removed in 3.0. Use getSurrogate() instead */ public function getEsi() diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 08742df2d9c85..67ea6545891f6 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -477,10 +477,10 @@ public function getOutput() * In comparison with the getOutput method which always return the whole * output, this one returns the new output since the last call. * + * @return string The process output since the last call + * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started - * - * @return string The process output since the last call */ public function getIncrementalOutput() { @@ -536,10 +536,10 @@ public function getErrorOutput() * whole error output, this one returns the new error output since the last * call. * + * @return string The process error output since the last call + * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started - * - * @return string The process error output since the last call */ public function getIncrementalErrorOutput() { diff --git a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php index 273625a48eb63..bd1976fa31851 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php @@ -554,9 +554,9 @@ protected function getInsertObjectIdentitySql($identifier, $classId, $entriesInh * * @param SecurityIdentityInterface $sid * - * @throws \InvalidArgumentException - * * @return string + * + * @throws \InvalidArgumentException */ protected function getInsertSecurityIdentitySql(SecurityIdentityInterface $sid) { @@ -626,9 +626,9 @@ protected function getSelectClassIdSql($classType) * * @param SecurityIdentityInterface $sid * - * @throws \InvalidArgumentException - * * @return string + * + * @throws \InvalidArgumentException */ protected function getSelectSecurityIdentityIdSql(SecurityIdentityInterface $sid) { @@ -655,9 +655,9 @@ protected function getSelectSecurityIdentityIdSql(SecurityIdentityInterface $sid * * @param SecurityIdentityInterface $sid * - * @throws \InvalidArgumentException - * * @return string + * + * @throws \InvalidArgumentException */ protected function getDeleteSecurityIdentityIdSql(SecurityIdentityInterface $sid) { @@ -673,9 +673,9 @@ protected function getDeleteSecurityIdentityIdSql(SecurityIdentityInterface $sid * @param int $pk * @param array $changes * - * @throws \InvalidArgumentException - * * @return string + * + * @throws \InvalidArgumentException */ protected function getUpdateObjectIdentitySql($pk, array $changes) { @@ -723,9 +723,9 @@ protected function getUpdateUserSecurityIdentitySql(UserSecurityIdentity $usid, * @param int $pk * @param array $sets * - * @throws \InvalidArgumentException - * * @return string + * + * @throws \InvalidArgumentException */ protected function getUpdateAccessControlEntrySql($pk, array $sets) { diff --git a/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php b/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php index 871bda7b10970..ec817e2e87b74 100644 --- a/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php +++ b/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php @@ -52,9 +52,9 @@ public function __construct($identifier, $type) * * @param object $domainObject * - * @throws InvalidDomainObjectException - * * @return ObjectIdentity + * + * @throws InvalidDomainObjectException */ public static function fromDomainObject($domainObject) { diff --git a/src/Symfony/Component/Security/Acl/Model/AclInterface.php b/src/Symfony/Component/Security/Acl/Model/AclInterface.php index 6a70a7c5943ac..13a6cf8394e34 100644 --- a/src/Symfony/Component/Security/Acl/Model/AclInterface.php +++ b/src/Symfony/Component/Security/Acl/Model/AclInterface.php @@ -97,9 +97,9 @@ public function isFieldGranted($field, array $masks, array $securityIdentities, * @param array $securityIdentities * @param bool $administrativeMode * - * @throws NoAceFoundException when no ACE was applicable for this request - * * @return bool + * + * @throws NoAceFoundException when no ACE was applicable for this request */ public function isGranted(array $masks, array $securityIdentities, $administrativeMode = false); diff --git a/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php b/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php index 95f531e09ba76..ee6d7c406ebd0 100644 --- a/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php +++ b/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php @@ -25,10 +25,10 @@ interface MutableAclProviderInterface extends AclProviderInterface * * @param ObjectIdentityInterface $oid * + * @return MutableAclInterface + * * @throws AclAlreadyExistsException when there already is an ACL for the given * object identity - * - * @return MutableAclInterface */ public function createAcl(ObjectIdentityInterface $oid); diff --git a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php index 0b5f388b48c69..ed13ecb8854f4 100644 --- a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php +++ b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php @@ -96,10 +96,10 @@ public function getPattern() * * @param int $mask * + * @return string + * * @throws \InvalidArgumentException * @throws \RuntimeException - * - * @return string */ public static function getCode($mask) { diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index be6688bc3d385..4c17fb6b8d859 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -460,9 +460,9 @@ private function needsCdataWrapping($val) * @param \DOMNode $node * @param mixed $val * - * @throws UnexpectedValueException - * * @return bool + * + * @throws UnexpectedValueException */ private function selectNodeType(\DOMNode $node, $val) { diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index b515611e7892e..8ad1386a6cbd4 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\ExceptionInterface; - /** * Defines the most basic interface a class must implement to be denormalizable. * @@ -36,8 +34,6 @@ interface DenormalizableInterface * based on different input formats * @param array $context options for denormalizing * - * @throws ExceptionInterface - * * @return object */ public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php index a544124f29e21..8b6c2333958fe 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\ExceptionInterface; - /** * Defines the interface of denormalizers. * @@ -28,8 +26,6 @@ interface DenormalizerInterface * @param string $format format the given data was extracted from * @param array $context options available to the denormalizer * - * @throws ExceptionInterface - * * @return object */ public function denormalize($data, $class, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php index ac3edb680dbe6..e19fe5ce58576 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\ExceptionInterface; - /** * Defines the most basic interface a class must implement to be normalizable. * @@ -35,8 +33,6 @@ interface NormalizableInterface * based on different output formats. * @param array $context Options for normalizing this object * - * @throws ExceptionInterface - * * @return array|scalar */ public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index 333397044b7b9..f4bd355232b0b 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Serializer\Normalizer; -use Symfony\Component\Serializer\Exception\ExceptionInterface; - /** * Defines the interface of normalizers. * @@ -27,8 +25,6 @@ interface NormalizerInterface * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * - * @throws ExceptionInterface - * * @return array|scalar */ public function normalize($object, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/SerializerInterface.php b/src/Symfony/Component/Serializer/SerializerInterface.php index 7d1fb2e465430..c79db91892075 100644 --- a/src/Symfony/Component/Serializer/SerializerInterface.php +++ b/src/Symfony/Component/Serializer/SerializerInterface.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Serializer; -use Symfony\Component\Serializer\Exception\ExceptionInterface; - /** * Defines the interface of the Serializer. * @@ -27,8 +25,6 @@ interface SerializerInterface * @param string $format format name * @param array $context options normalizers/encoders have access to * - * @throws ExceptionInterface - * * @return string */ public function serialize($data, $format, array $context = array()); @@ -41,8 +37,6 @@ public function serialize($data, $format, array $context = array()); * @param string $format * @param array $context * - * @throws ExceptionInterface - * * @return object */ public function deserialize($data, $type, $format, array $context = array()); diff --git a/src/Symfony/Component/Stopwatch/StopwatchEvent.php b/src/Symfony/Component/Stopwatch/StopwatchEvent.php index 930722d2f598c..957a5d0dae0a8 100644 --- a/src/Symfony/Component/Stopwatch/StopwatchEvent.php +++ b/src/Symfony/Component/Stopwatch/StopwatchEvent.php @@ -87,8 +87,6 @@ public function start() /** * Stops the last started event period. * - * @throws \LogicException When start wasn't called before stopping - * * @return StopwatchEvent The event * * @throws \LogicException When stop() is called without a matching call to start() diff --git a/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php b/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php index 196bc3341060a..57fd4938d22cf 100644 --- a/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php @@ -54,9 +54,9 @@ private function toSplFileInfo($file) /** * @param string $file * - * @throws \InvalidArgumentException - * * @return bool + * + * @throws \InvalidArgumentException */ protected function isFile($file) { diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 0e335db425cd3..0381a4ca4d8f7 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -112,10 +112,9 @@ private function utf8ToCharset($content, $encoding = null) * * @param string $file * - * @throws \RuntimeException - * * @return \SimpleXMLElement * + * @throws \RuntimeException * @throws InvalidResourceException */ private function parseFile($file) diff --git a/src/Symfony/Component/Translation/TranslatorBagInterface.php b/src/Symfony/Component/Translation/TranslatorBagInterface.php index 6f650b5ee0f88..14fbb17f5e46e 100644 --- a/src/Symfony/Component/Translation/TranslatorBagInterface.php +++ b/src/Symfony/Component/Translation/TranslatorBagInterface.php @@ -23,9 +23,9 @@ interface TranslatorBagInterface * * @param string|null $locale The locale or null to use the default * - * @throws \InvalidArgumentException If the locale contains invalid characters - * * @return MessageCatalogueInterface + * + * @throws \InvalidArgumentException If the locale contains invalid characters */ public function getCatalogue($locale = null); } diff --git a/src/Symfony/Component/Translation/TranslatorInterface.php b/src/Symfony/Component/Translation/TranslatorInterface.php index 869e0b900442d..6916c335bd426 100644 --- a/src/Symfony/Component/Translation/TranslatorInterface.php +++ b/src/Symfony/Component/Translation/TranslatorInterface.php @@ -26,9 +26,9 @@ interface TranslatorInterface * @param string|null $domain The domain for the message or null to use the default * @param string|null $locale The locale or null to use the default * - * @throws \InvalidArgumentException If the locale contains invalid characters - * * @return string The translated string + * + * @throws \InvalidArgumentException If the locale contains invalid characters */ public function trans($id, array $parameters = array(), $domain = null, $locale = null); @@ -41,9 +41,9 @@ public function trans($id, array $parameters = array(), $domain = null, $locale * @param string|null $domain The domain for the message or null to use the default * @param string|null $locale The locale or null to use the default * - * @throws \InvalidArgumentException If the locale contains invalid characters - * * @return string The translated string + * + * @throws \InvalidArgumentException If the locale contains invalid characters */ public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); From 9fc48b8bb24cd62100adae711daee05b0a04ee15 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 6 Jun 2016 13:49:15 +0200 Subject: [PATCH 74/79] [Debug] Fix context dependent test --- src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index 12f2fcb40bc8d..f3b7701c3f738 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -428,7 +428,7 @@ public function testHandleErrorException() $handler->handleException($exception); $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]); - $this->assertSame("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement?", $args[0]->getMessage()); + $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); } public function testHandleFatalErrorOnHHVM() From 065dee8525e51091407221ece8a81424bb6bb0f0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 6 Jun 2016 14:20:11 +0200 Subject: [PATCH 75/79] [HttpKernel] Fix context dependent test --- .../FrameworkBundle/Tests/Controller/ControllerResolverTest.php | 2 +- .../HttpKernel/Tests/Controller/ControllerResolverTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php index b4dc8ada555b6..00ffa4c1fd162 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php @@ -150,7 +150,7 @@ public function getUndefinedControllers() { return array( array('foo', '\LogicException', 'Unable to parse the controller name "foo".'), - array('foo::bar', '\InvalidArgumentException', 'Class "foo" does not exist.'), + array('oof::bar', '\InvalidArgumentException', 'Class "oof" does not exist.'), array('stdClass', '\LogicException', 'Unable to parse the controller name "stdClass".'), array( 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar', diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index 7fc127e49b647..101782e49079e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -127,7 +127,7 @@ public function getUndefinedControllers() { return array( array('foo'), - array('foo::bar'), + array('oof::bar'), array('stdClass'), array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar'), ); From 73b812e3a8dd6d943db5315f852360daa1b7b60a Mon Sep 17 00:00:00 2001 From: Alexander Obuhovich Date: Fri, 3 Jun 2016 17:53:01 +0300 Subject: [PATCH 76/79] Make one call to "OutputInterface::write" method per table row --- .../Component/Console/Helper/Table.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index f0445e118d585..c4e24a63d916d 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -257,7 +257,7 @@ private function renderRowSeparator() */ private function renderColumnSeparator() { - $this->output->write(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); + return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()); } /** @@ -274,12 +274,12 @@ private function renderRow(array $row, $cellFormat) return; } - $this->renderColumnSeparator(); + $rowContent = $this->renderColumnSeparator(); foreach ($this->getRowColumns($row) as $column) { - $this->renderCell($row, $column, $cellFormat); - $this->renderColumnSeparator(); + $rowContent .= $this->renderCell($row, $column, $cellFormat); + $rowContent .= $this->renderColumnSeparator(); } - $this->output->writeln(''); + $this->output->writeln($rowContent); } /** @@ -306,12 +306,13 @@ private function renderCell(array $row, $column, $cellFormat) } if ($cell instanceof TableSeparator) { - $this->output->write(sprintf($this->style->getBorderFormat(), str_repeat($this->style->getHorizontalBorderChar(), $width))); - } else { - $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); - $content = sprintf($this->style->getCellRowContentFormat(), $cell); - $this->output->write(sprintf($cellFormat, str_pad($content, $width, $this->style->getPaddingChar(), $this->style->getPadType()))); + return sprintf($this->style->getBorderFormat(), str_repeat($this->style->getHorizontalBorderChar(), $width)); } + + $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); + $content = sprintf($this->style->getCellRowContentFormat(), $cell); + + return sprintf($cellFormat, str_pad($content, $width, $this->style->getPaddingChar(), $this->style->getPadType())); } /** From 5579d8645423c55bc5144f8fe99511724a43e012 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 6 Jun 2016 13:57:55 +0100 Subject: [PATCH 77/79] [BrowserKit] Bump dom-crawler minimum version requirement The BrowserKit Client will not work with DomCrawler 2.0 if the CssSelector component is not installed. --- src/Symfony/Component/BrowserKit/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json index 7c0234e1fed7b..344e3e81afed1 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3.9", - "symfony/dom-crawler": "~2.0,>=2.0.5" + "symfony/dom-crawler": "~2.1" }, "require-dev": { "symfony/process": "~2.3.34|~2.7,>=2.7.6", From bde636a0dc7726cd09ecbe2614b0861caffe5ddc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Jun 2016 18:52:28 +0200 Subject: [PATCH 78/79] updated CHANGELOG for 3.0.7 --- CHANGELOG-3.0.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG-3.0.md b/CHANGELOG-3.0.md index 4d98c24a93e44..00be856735c24 100644 --- a/CHANGELOG-3.0.md +++ b/CHANGELOG-3.0.md @@ -7,6 +7,37 @@ in 3.0 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.0.0...v3.0.1 +* 3.0.7 (2016-06-06) + + * bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh) + * bug #18893 [DependencyInjection] Skip deep reference check for 'service_container' (RobertMe) + * bug #18812 Catch \Throwable (fprochazka) + * bug #18821 [Form] Removed UTC specification with timestamp (francisbesset) + * bug #18861 Fix for #18843 (inso) + * bug #18889 [Console] SymfonyStyle: Fix alignment/prefixing of multi-line comments (chalasr) + * bug #18907 [Routing] Fix the annotation loader taking a class constant as a beginning of a class name (jakzal, nicolas-grekas) + * bug #18879 [Console] SymfonyStyle: Align multi-line/very-long-line blocks (chalasr) + * bug #18864 [Console][DX] Fixed ambiguous error message when using a duplicate option shortcut (peterrehm) + * bug #18883 Fix js comment in profiler (linnaea) + * bug #18844 [Yaml] fix exception contexts (xabbuh) + * bug #18840 [Yaml] properly handle unindented collections (xabbuh) + * bug #18765 Catch \Throwable (fprochazka) + * bug #18813 Catch \Throwable (fprochazka) + * bug #18839 People - person singularization (Keeo) + * bug #18828 [Yaml] chomp newlines only at the end of YAML documents (xabbuh) + * bug #18814 Fixed server status command when port has been omitted (peterrehm) + * bug #18759 [Validator] Support for DateTimeImmutable (krzysiekpiasecki) + * bug #18799 Use levenshtein level for better Bundle matching (j0k3r) + * bug #18413 [WebProfilerBundle] Fix CORS ajax security issues (romainneutron) + * bug #18774 [console][table] adjust width of colspanned cell. (aitboudad) + * bug #18507 [BUG] Delete class 'control-group' in bootstrap 3 (Philippe Degeeter) + * bug #18747 [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper (issei-m) + * bug #18635 [Console] Prevent fatal error when calling Command::getHelper without helperSet (chalasr) + * bug #18686 [console][table] adjust width of colspanned cell. (aitboudad) + * bug #18761 [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper (issei-m) + * bug #18745 [MonologBridge] Uninstallable together with symfony/http-kernel in 3.0.6 (ymc-dabe) + * bug #18737 [Debug] Fix fatal error handlers on PHP 7 (nicolas-grekas) + * 3.0.6 (2016-05-10) * security #18736 Fixed issue with blank password with Ldap (csarrazi) From fa7e94050ef358e645b3988b36cc7bfdb32bd22c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Jun 2016 18:52:35 +0200 Subject: [PATCH 79/79] updated VERSION for 3.0.7 --- 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 3624faf07b183..ddff065a23779 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '3.0.7-DEV'; + const VERSION = '3.0.7'; const VERSION_ID = 30007; const MAJOR_VERSION = 3; const MINOR_VERSION = 0; const RELEASE_VERSION = 7; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2016'; const END_OF_LIFE = '01/2017';