From d8f839d7a1f712a8748b875df566bcbf52ad5d84 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Nov 2014 09:37:22 +0100 Subject: [PATCH 001/240] updated version to 3.0 --- composer.json | 2 +- src/Symfony/Bridge/Doctrine/composer.json | 2 +- src/Symfony/Bridge/Monolog/composer.json | 2 +- src/Symfony/Bridge/Propel1/composer.json | 2 +- src/Symfony/Bridge/ProxyManager/composer.json | 2 +- src/Symfony/Bridge/Swiftmailer/composer.json | 2 +- src/Symfony/Bridge/Twig/composer.json | 2 +- src/Symfony/Bundle/DebugBundle/composer.json | 2 +- src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +- src/Symfony/Bundle/SecurityBundle/composer.json | 2 +- src/Symfony/Bundle/TwigBundle/composer.json | 2 +- src/Symfony/Bundle/WebProfilerBundle/composer.json | 2 +- src/Symfony/Component/BrowserKit/composer.json | 2 +- src/Symfony/Component/ClassLoader/composer.json | 2 +- src/Symfony/Component/Config/composer.json | 2 +- src/Symfony/Component/Console/composer.json | 2 +- src/Symfony/Component/CssSelector/composer.json | 2 +- src/Symfony/Component/Debug/composer.json | 2 +- src/Symfony/Component/DependencyInjection/composer.json | 2 +- src/Symfony/Component/DomCrawler/composer.json | 2 +- src/Symfony/Component/EventDispatcher/composer.json | 2 +- src/Symfony/Component/ExpressionLanguage/composer.json | 2 +- src/Symfony/Component/Filesystem/composer.json | 2 +- src/Symfony/Component/Finder/composer.json | 2 +- src/Symfony/Component/Form/README.md | 2 +- src/Symfony/Component/Form/composer.json | 2 +- src/Symfony/Component/HttpFoundation/composer.json | 2 +- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- src/Symfony/Component/HttpKernel/composer.json | 2 +- src/Symfony/Component/Intl/README.md | 2 +- src/Symfony/Component/Intl/composer.json | 2 +- src/Symfony/Component/Locale/composer.json | 2 +- src/Symfony/Component/OptionsResolver/composer.json | 2 +- src/Symfony/Component/Process/composer.json | 2 +- src/Symfony/Component/PropertyAccess/composer.json | 2 +- src/Symfony/Component/Routing/composer.json | 2 +- src/Symfony/Component/Security/Acl/README.md | 2 +- src/Symfony/Component/Security/Acl/composer.json | 2 +- src/Symfony/Component/Security/Core/README.md | 2 +- src/Symfony/Component/Security/Core/composer.json | 2 +- src/Symfony/Component/Security/Csrf/README.md | 2 +- src/Symfony/Component/Security/Csrf/composer.json | 2 +- src/Symfony/Component/Security/Http/README.md | 2 +- src/Symfony/Component/Security/Http/composer.json | 2 +- src/Symfony/Component/Security/README.md | 2 +- src/Symfony/Component/Security/composer.json | 2 +- src/Symfony/Component/Serializer/composer.json | 2 +- src/Symfony/Component/Stopwatch/composer.json | 2 +- src/Symfony/Component/Templating/composer.json | 2 +- src/Symfony/Component/Translation/README.md | 2 +- src/Symfony/Component/Translation/composer.json | 2 +- src/Symfony/Component/Validator/README.md | 2 +- src/Symfony/Component/Validator/composer.json | 2 +- src/Symfony/Component/VarDumper/composer.json | 2 +- src/Symfony/Component/Yaml/composer.json | 2 +- 55 files changed, 58 insertions(+), 58 deletions(-) diff --git a/composer.json b/composer.json index 7026ec3dfab91..fa36e75f186a8 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 573c5ba5d4725..1c61595b78475 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -45,7 +45,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index fc1cc1b987186..f66bb561fb343 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -36,7 +36,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bridge/Propel1/composer.json b/src/Symfony/Bridge/Propel1/composer.json index 9ea191d20e368..b9feb6af7f1e3 100644 --- a/src/Symfony/Bridge/Propel1/composer.json +++ b/src/Symfony/Bridge/Propel1/composer.json @@ -32,7 +32,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index 1ad48ccd1d814..5e89ce5ca0c26 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -32,7 +32,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bridge/Swiftmailer/composer.json b/src/Symfony/Bridge/Swiftmailer/composer.json index 098ff0e682736..470dd54f8148d 100644 --- a/src/Symfony/Bridge/Swiftmailer/composer.json +++ b/src/Symfony/Bridge/Swiftmailer/composer.json @@ -29,7 +29,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 22ada09185159..4fd26da0d1865 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -54,7 +54,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json index 19a584c8e0498..69cd5c153ea03 100644 --- a/src/Symfony/Bundle/DebugBundle/composer.json +++ b/src/Symfony/Bundle/DebugBundle/composer.json @@ -36,7 +36,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 92bf96869933c..a960e7bc0d4bb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -58,7 +58,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index d3f79c12ca4f5..1f67c8ba19416 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -39,7 +39,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 80ac4cd57e9df..45ee25d607dee 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -37,7 +37,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json index 3f9aea4855df3..41e723019d70c 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/composer.json +++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json @@ -34,7 +34,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json index 323202b74fbef..277ab5144746d 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -33,7 +33,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/ClassLoader/composer.json b/src/Symfony/Component/ClassLoader/composer.json index 6c11dd8c3a2fd..094844814ac3c 100644 --- a/src/Symfony/Component/ClassLoader/composer.json +++ b/src/Symfony/Component/ClassLoader/composer.json @@ -28,7 +28,7 @@ "target-dir": "Symfony/Component/ClassLoader", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Config/composer.json b/src/Symfony/Component/Config/composer.json index dd71f7c9fbb7a..2da16c5620506 100644 --- a/src/Symfony/Component/Config/composer.json +++ b/src/Symfony/Component/Config/composer.json @@ -26,7 +26,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Console/composer.json b/src/Symfony/Component/Console/composer.json index 743d375a39733..0e7fdc9515d48 100644 --- a/src/Symfony/Component/Console/composer.json +++ b/src/Symfony/Component/Console/composer.json @@ -35,7 +35,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/CssSelector/composer.json b/src/Symfony/Component/CssSelector/composer.json index ee227439e86e6..12c782038e913 100644 --- a/src/Symfony/Component/CssSelector/composer.json +++ b/src/Symfony/Component/CssSelector/composer.json @@ -29,7 +29,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Debug/composer.json b/src/Symfony/Component/Debug/composer.json index c4494b1645781..fa18b60ebcd1f 100644 --- a/src/Symfony/Component/Debug/composer.json +++ b/src/Symfony/Component/Debug/composer.json @@ -34,7 +34,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index 3f171a33acbae..c1d8c4560bf4a 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -35,7 +35,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/DomCrawler/composer.json b/src/Symfony/Component/DomCrawler/composer.json index dea7d2329e554..2a04cf511cdd1 100644 --- a/src/Symfony/Component/DomCrawler/composer.json +++ b/src/Symfony/Component/DomCrawler/composer.json @@ -31,7 +31,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/EventDispatcher/composer.json b/src/Symfony/Component/EventDispatcher/composer.json index 08f1ff9ced051..6ece50892d294 100644 --- a/src/Symfony/Component/EventDispatcher/composer.json +++ b/src/Symfony/Component/EventDispatcher/composer.json @@ -36,7 +36,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/ExpressionLanguage/composer.json b/src/Symfony/Component/ExpressionLanguage/composer.json index 8e6193cfe4b77..40f241bdcf9c0 100644 --- a/src/Symfony/Component/ExpressionLanguage/composer.json +++ b/src/Symfony/Component/ExpressionLanguage/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Filesystem/composer.json b/src/Symfony/Component/Filesystem/composer.json index c5682684b3525..33d4dd8466c92 100644 --- a/src/Symfony/Component/Filesystem/composer.json +++ b/src/Symfony/Component/Filesystem/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Finder/composer.json b/src/Symfony/Component/Finder/composer.json index 7e3264275eb0c..f1edff50204fe 100644 --- a/src/Symfony/Component/Finder/composer.json +++ b/src/Symfony/Component/Finder/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Form/README.md b/src/Symfony/Component/Form/README.md index 2bd259debf989..3450c0161181d 100644 --- a/src/Symfony/Component/Form/README.md +++ b/src/Symfony/Component/Form/README.md @@ -14,7 +14,7 @@ https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/FormServiceProvid Documentation: -http://symfony.com/doc/2.7/book/forms.html +http://symfony.com/doc/3.0/book/forms.html Resources --------- diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json index bad48b84515b1..52aed058e3abe 100644 --- a/src/Symfony/Component/Form/composer.json +++ b/src/Symfony/Component/Form/composer.json @@ -42,7 +42,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/HttpFoundation/composer.json b/src/Symfony/Component/HttpFoundation/composer.json index e0d86584ad065..a6c8f51b8d8fd 100644 --- a/src/Symfony/Component/HttpFoundation/composer.json +++ b/src/Symfony/Component/HttpFoundation/composer.json @@ -29,7 +29,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index df1742c63c649..611d5d9ac1be5 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,10 +59,10 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.0-DEV'; - const VERSION_ID = '20700'; - const MAJOR_VERSION = '2'; - const MINOR_VERSION = '7'; + const VERSION = '3.0.0-DEV'; + const VERSION_ID = '30000'; + const MAJOR_VERSION = '3'; + const MINOR_VERSION = '0'; const RELEASE_VERSION = '0'; const EXTRA_VERSION = 'DEV'; diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 063257ecc1f33..778d239aee290 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -53,7 +53,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Intl/README.md b/src/Symfony/Component/Intl/README.md index dd7b562f26cb9..f94877811d143 100644 --- a/src/Symfony/Component/Intl/README.md +++ b/src/Symfony/Component/Intl/README.md @@ -22,4 +22,4 @@ You can run the unit tests with the following command: $ phpunit [0]: http://www.php.net/manual/en/intl.setup.php -[1]: http://symfony.com/doc/2.7/components/intl.html +[1]: http://symfony.com/doc/3.0/components/intl.html diff --git a/src/Symfony/Component/Intl/composer.json b/src/Symfony/Component/Intl/composer.json index d5cbf21a8dd62..beca5c92363e3 100644 --- a/src/Symfony/Component/Intl/composer.json +++ b/src/Symfony/Component/Intl/composer.json @@ -41,7 +41,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Locale/composer.json b/src/Symfony/Component/Locale/composer.json index 02461a174dd03..cc4fb2237a3f4 100644 --- a/src/Symfony/Component/Locale/composer.json +++ b/src/Symfony/Component/Locale/composer.json @@ -26,7 +26,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/OptionsResolver/composer.json b/src/Symfony/Component/OptionsResolver/composer.json index b5f67b6f1cf4f..49a1607a1b7aa 100644 --- a/src/Symfony/Component/OptionsResolver/composer.json +++ b/src/Symfony/Component/OptionsResolver/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Process/composer.json b/src/Symfony/Component/Process/composer.json index 901b920e474e1..938b3987ab737 100644 --- a/src/Symfony/Component/Process/composer.json +++ b/src/Symfony/Component/Process/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/PropertyAccess/composer.json b/src/Symfony/Component/PropertyAccess/composer.json index 276f46250d85a..796b736888182 100644 --- a/src/Symfony/Component/PropertyAccess/composer.json +++ b/src/Symfony/Component/PropertyAccess/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json index 2a596b95a9e94..8298506f3a20e 100644 --- a/src/Symfony/Component/Routing/composer.json +++ b/src/Symfony/Component/Routing/composer.json @@ -39,7 +39,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Security/Acl/README.md b/src/Symfony/Component/Security/Acl/README.md index 4b68d909ead51..d640ac2ac478e 100644 --- a/src/Symfony/Component/Security/Acl/README.md +++ b/src/Symfony/Component/Security/Acl/README.md @@ -11,7 +11,7 @@ Resources Documentation: -http://symfony.com/doc/2.7/book/security.html +http://symfony.com/doc/3.0/book/security.html Tests ----- diff --git a/src/Symfony/Component/Security/Acl/composer.json b/src/Symfony/Component/Security/Acl/composer.json index 8f65f5034ae42..a1a5d6a526b33 100644 --- a/src/Symfony/Component/Security/Acl/composer.json +++ b/src/Symfony/Component/Security/Acl/composer.json @@ -36,7 +36,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Security/Core/README.md b/src/Symfony/Component/Security/Core/README.md index 8e05a92d4d60e..4cc3c6ddef499 100644 --- a/src/Symfony/Component/Security/Core/README.md +++ b/src/Symfony/Component/Security/Core/README.md @@ -11,7 +11,7 @@ Resources Documentation: -http://symfony.com/doc/2.7/book/security.html +http://symfony.com/doc/3.0/book/security.html Tests ----- diff --git a/src/Symfony/Component/Security/Core/composer.json b/src/Symfony/Component/Security/Core/composer.json index 5182a71399662..f27b2c716ae8a 100644 --- a/src/Symfony/Component/Security/Core/composer.json +++ b/src/Symfony/Component/Security/Core/composer.json @@ -40,7 +40,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Security/Csrf/README.md b/src/Symfony/Component/Security/Csrf/README.md index 30d7bb284943b..85f9114ad74e4 100644 --- a/src/Symfony/Component/Security/Csrf/README.md +++ b/src/Symfony/Component/Security/Csrf/README.md @@ -9,7 +9,7 @@ Resources Documentation: -http://symfony.com/doc/2.7/book/security.html +http://symfony.com/doc/3.0/book/security.html Tests ----- diff --git a/src/Symfony/Component/Security/Csrf/composer.json b/src/Symfony/Component/Security/Csrf/composer.json index 0ed6428df09ce..16099a6e4e0c7 100644 --- a/src/Symfony/Component/Security/Csrf/composer.json +++ b/src/Symfony/Component/Security/Csrf/composer.json @@ -32,7 +32,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Security/Http/README.md b/src/Symfony/Component/Security/Http/README.md index 35437f28cbe3b..abf0cce840235 100644 --- a/src/Symfony/Component/Security/Http/README.md +++ b/src/Symfony/Component/Security/Http/README.md @@ -11,7 +11,7 @@ Resources Documentation: -http://symfony.com/doc/2.7/book/security.html +http://symfony.com/doc/3.0/book/security.html Tests ----- diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index 625353e06cadd..394267b3f0738 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -38,7 +38,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Security/README.md b/src/Symfony/Component/Security/README.md index 66c7d80a9fdac..32894b124f2b4 100644 --- a/src/Symfony/Component/Security/README.md +++ b/src/Symfony/Component/Security/README.md @@ -11,7 +11,7 @@ Resources Documentation: -http://symfony.com/doc/2.7/book/security.html +http://symfony.com/doc/3.0/book/security.html Tests ----- diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index 435d92e7e0f77..2e7bf02f79bba 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -52,7 +52,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index 026be84e1c900..ca4407eed8870 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json index e2dfccbd757f1..99821957ffbbe 100644 --- a/src/Symfony/Component/Stopwatch/composer.json +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Templating/composer.json b/src/Symfony/Component/Templating/composer.json index ab98c9d00ec39..91defd0602213 100644 --- a/src/Symfony/Component/Templating/composer.json +++ b/src/Symfony/Component/Templating/composer.json @@ -31,7 +31,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Translation/README.md b/src/Symfony/Component/Translation/README.md index b1de2500263be..62a18ab042b39 100644 --- a/src/Symfony/Component/Translation/README.md +++ b/src/Symfony/Component/Translation/README.md @@ -28,7 +28,7 @@ https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServic Documentation: -http://symfony.com/doc/2.7/book/translation.html +http://symfony.com/doc/3.0/book/translation.html You can run the unit tests with the following command: diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json index 608fd52d29c45..b6d1e21f10039 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -36,7 +36,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Validator/README.md b/src/Symfony/Component/Validator/README.md index 9788f558f3d7c..5d105640bdd67 100644 --- a/src/Symfony/Component/Validator/README.md +++ b/src/Symfony/Component/Validator/README.md @@ -113,7 +113,7 @@ https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/ValidatorServiceP Documentation: -http://symfony.com/doc/2.7/book/validation.html +http://symfony.com/doc/3.0/book/validation.html JSR-303 Specification: diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index 36c9cacd016b1..c378ab7412e5b 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -49,7 +49,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/VarDumper/composer.json b/src/Symfony/Component/VarDumper/composer.json index 025491a528e43..58560fbcb5426 100644 --- a/src/Symfony/Component/VarDumper/composer.json +++ b/src/Symfony/Component/VarDumper/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } diff --git a/src/Symfony/Component/Yaml/composer.json b/src/Symfony/Component/Yaml/composer.json index 1aa0018ac5609..1ca239845b934 100644 --- a/src/Symfony/Component/Yaml/composer.json +++ b/src/Symfony/Component/Yaml/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } } } From 0ab13b9d8eb162fba86eb7035ca75031ac82b51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Andrieu?= Date: Tue, 11 Nov 2014 19:15:15 +0100 Subject: [PATCH 002/240] Publics methods are protected, class become abstract --- .../FrameworkBundle/Controller/Controller.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index b3c7f42c2ce27..156d7b4aab6c9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -33,7 +33,7 @@ * * @author Fabien Potencier */ -class Controller extends ContainerAware +abstract class Controller extends ContainerAware { /** * Generates a URL from the given parameters. @@ -46,7 +46,7 @@ class Controller extends ContainerAware * * @see UrlGeneratorInterface */ - public function generateUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) + protected function generateUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) { return $this->container->get('router')->generate($route, $parameters, $referenceType); } @@ -60,7 +60,7 @@ public function generateUrl($route, $parameters = array(), $referenceType = UrlG * * @return Response A Response instance */ - public function forward($controller, array $path = array(), array $query = array()) + protected function forward($controller, array $path = array(), array $query = array()) { $path['_controller'] = $controller; $subRequest = $this->container->get('request_stack')->getCurrentRequest()->duplicate($query, null, $path); @@ -76,7 +76,7 @@ public function forward($controller, array $path = array(), array $query = array * * @return RedirectResponse */ - public function redirect($url, $status = 302) + protected function redirect($url, $status = 302) { return new RedirectResponse($url, $status); } @@ -155,7 +155,7 @@ protected function denyAccessUnlessGranted($attributes, $object = null, $message * * @return string The rendered view */ - public function renderView($view, array $parameters = array()) + protected function renderView($view, array $parameters = array()) { return $this->container->get('templating')->render($view, $parameters); } @@ -169,7 +169,7 @@ public function renderView($view, array $parameters = array()) * * @return Response A Response instance */ - public function render($view, array $parameters = array(), Response $response = null) + protected function render($view, array $parameters = array(), Response $response = null) { return $this->container->get('templating')->renderResponse($view, $parameters, $response); } @@ -183,7 +183,7 @@ public function render($view, array $parameters = array(), Response $response = * * @return StreamedResponse A StreamedResponse instance */ - public function stream($view, array $parameters = array(), StreamedResponse $response = null) + protected function stream($view, array $parameters = array(), StreamedResponse $response = null) { $templating = $this->container->get('templating'); @@ -212,7 +212,7 @@ public function stream($view, array $parameters = array(), StreamedResponse $res * * @return NotFoundHttpException */ - public function createNotFoundException($message = 'Not Found', \Exception $previous = null) + protected function createNotFoundException($message = 'Not Found', \Exception $previous = null) { return new NotFoundHttpException($message, $previous); } @@ -229,7 +229,7 @@ public function createNotFoundException($message = 'Not Found', \Exception $prev * * @return AccessDeniedException */ - public function createAccessDeniedException($message = 'Access Denied', \Exception $previous = null) + protected function createAccessDeniedException($message = 'Access Denied', \Exception $previous = null) { return new AccessDeniedException($message, $previous); } @@ -243,7 +243,7 @@ public function createAccessDeniedException($message = 'Access Denied', \Excepti * * @return Form */ - public function createForm($type, $data = null, array $options = array()) + protected function createForm($type, $data = null, array $options = array()) { return $this->container->get('form.factory')->create($type, $data, $options); } @@ -256,7 +256,7 @@ public function createForm($type, $data = null, array $options = array()) * * @return FormBuilder */ - public function createFormBuilder($data = null, array $options = array()) + protected function createFormBuilder($data = null, array $options = array()) { return $this->container->get('form.factory')->createBuilder('form', $data, $options); } @@ -270,7 +270,7 @@ public function createFormBuilder($data = null, array $options = array()) * Symfony to inject the Request object into your controller * method instead by type hinting it in the method's signature. */ - public function getRequest() + protected function getRequest() { return $this->container->get('request_stack')->getCurrentRequest(); } @@ -282,7 +282,7 @@ public function getRequest() * * @throws \LogicException If DoctrineBundle is not available */ - public function getDoctrine() + protected function getDoctrine() { if (!$this->container->has('doctrine')) { throw new \LogicException('The DoctrineBundle is not registered in your application.'); @@ -300,7 +300,7 @@ public function getDoctrine() * * @see Symfony\Component\Security\Core\Authentication\Token\TokenInterface::getUser() */ - public function getUser() + protected function getUser() { if (!$this->container->has('security.context')) { throw new \LogicException('The SecurityBundle is not registered in your application.'); @@ -324,7 +324,7 @@ public function getUser() * * @return bool true if the service id is defined, false otherwise */ - public function has($id) + protected function has($id) { return $this->container->has($id); } @@ -336,7 +336,7 @@ public function has($id) * * @return object The service */ - public function get($id) + protected function get($id) { return $this->container->get($id); } From 37b49e1095fd3a7f3df977d695e20090c50c96e2 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Wed, 12 Nov 2014 01:01:01 +0100 Subject: [PATCH 003/240] [HttpKernel] Removed deprecated Kernel::init() method --- .../FrameworkBundle/Tests/Functional/app/AppKernel.php | 4 ---- .../SecurityBundle/Tests/Functional/app/AppKernel.php | 4 ---- src/Symfony/Component/HttpKernel/CHANGELOG.md | 7 ++++++- src/Symfony/Component/HttpKernel/Kernel.php | 9 --------- .../Tests/DataCollector/ConfigDataCollectorTest.php | 4 ---- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 12747e6dc2be3..31cd7ef9dfc03 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -74,10 +74,6 @@ public function registerBundles() return include $filename; } - public function init() - { - } - public function getRootDir() { return __DIR__; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php index 57816ccef9264..f3881788fd876 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php @@ -74,10 +74,6 @@ public function registerBundles() return include $filename; } - public function init() - { - } - public function getRootDir() { return __DIR__; diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index ed7f6035ace95..ad32deb12c81e 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +3.0.0 +----- + +* Removed `Symfony\Component\HttpKernel\Kernel::init()` + 2.6.0 ----- @@ -24,7 +29,7 @@ CHANGELOG * [BC BREAK] renamed `Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener` to `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener` and changed its constructor * deprecated `Symfony\Component\HttpKernel\Debug\ErrorHandler`, `Symfony\Component\HttpKernel\Debug\ExceptionHandler`, `Symfony\Component\HttpKernel\Exception\FatalErrorException`, and `Symfony\Component\HttpKernel\Exception\FlattenException` - * deprecated `Symfony\Component\HttpKernel\Kernel::init()`` + * deprecated `Symfony\Component\HttpKernel\Kernel::init()` * added the possibility to specify an id an extra attributes to hinclude tags * added the collect of data if a controller is a Closure in the Request collector * pass exceptions from the ExceptionListener to the logger using the logging context to allow for more diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 611d5d9ac1be5..bcc59931d31e5 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -84,15 +84,6 @@ public function __construct($environment, $debug) if ($this->debug) { $this->startTime = microtime(true); } - - $this->init(); - } - - /** - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Move your logic in the constructor instead. - */ - public function init() - { } public function __clone() diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 0c7396158631f..f9c42c0d75ae6 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -69,10 +69,6 @@ public function registerBundles() { } - public function init() - { - } - public function getBundles() { return array(); From 5e9aa165fb21ede22061ad96e6bc086ba24bb092 Mon Sep 17 00:00:00 2001 From: FlorianLB Date: Sat, 29 Nov 2014 11:54:37 +0100 Subject: [PATCH 004/240] [FrameworkBundle] remove deprecated method 'createEsi' --- UPGRADE-3.0.md | 2 ++ .../Bundle/FrameworkBundle/HttpCache/HttpCache.php | 12 ------------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 14520c1c6fa7a..68c7b5d464ec4 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -369,6 +369,8 @@ UPGRADE FROM 2.x to 3.0 * The `RouterApacheDumperCommand` was removed. + * The `createEsi` method of `Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache` was removed. Use `createSurrogate` instead. + ### HttpKernel * The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in diff --git a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php index bc5a0cc82fb89..fad4adc04434d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php +++ b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php @@ -71,18 +71,6 @@ protected function getOptions() } protected function createSurrogate() - { - return $this->createEsi(); - } - - /** - * Creates new ESI instance - * - * @return Esi - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use createSurrogate() instead - */ - protected function createEsi() { return new Esi(); } From e2334d9624c6ef1e9fcecd81198c5a46272fdb02 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Sat, 29 Nov 2014 12:57:28 +0100 Subject: [PATCH 005/240] [Process] Remove deprecated methods --- src/Symfony/Component/Process/Process.php | 31 ----------------------- 1 file changed, 31 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index d1d0ae1066c2a..ccad5e3624ab9 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1047,19 +1047,6 @@ public function setEnv(array $env) return $this; } - /** - * Gets the contents of STDIN. - * - * @return string|null The current contents - * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * This method is deprecated in favor of getInput. - */ - public function getStdin() - { - return $this->getInput(); - } - /** * Gets the Process input. * @@ -1070,24 +1057,6 @@ public function getInput() return $this->input; } - /** - * Sets the contents of STDIN. - * - * @param string|null $stdin The new contents - * - * @return self The current Process instance - * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * This method is deprecated in favor of setInput. - * - * @throws LogicException In case the process is running - * @throws InvalidArgumentException In case the argument is invalid - */ - public function setStdin($stdin) - { - return $this->setInput($stdin); - } - /** * Sets the input. * From 9ecfc84564f40d18f84b91c9179fe8dc23972158 Mon Sep 17 00:00:00 2001 From: FlorianLB Date: Sat, 29 Nov 2014 13:38:54 +0100 Subject: [PATCH 006/240] [Monolog Bridge] Remove deprecated log methods + add unit tests --- UPGRADE-3.0.md | 8 +++ src/Symfony/Bridge/Monolog/Logger.php | 32 ---------- .../Bridge/Monolog/Tests/LoggerTest.php | 61 +++++++++++++++++++ 3 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 src/Symfony/Bridge/Monolog/Tests/LoggerTest.php diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 14520c1c6fa7a..7dbd53505604b 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -998,3 +998,11 @@ UPGRADE FROM 2.x to 3.0 * `Process::setStdin()` and `Process::getStdin()` have been removed. Use `Process::setInput()` and `Process::getInput()` that works the same way. * `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types. + +### Monolog Bridge + + * `Symfony\Bridge\Monolog\Logger::emerg()` was removed. Use `emergency()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::crit()` was removed. Use `critical()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::err()` was removed. Use `error()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::warn()` was removed. Use `warning()` which is PSR-3 compatible. + diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php index b675069ef762a..86ddc4a545ba5 100644 --- a/src/Symfony/Bridge/Monolog/Logger.php +++ b/src/Symfony/Bridge/Monolog/Logger.php @@ -22,38 +22,6 @@ */ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface { - /** - * @deprecated since 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible. - */ - public function emerg($message, array $context = array()) - { - return parent::addRecord(BaseLogger::EMERGENCY, $message, $context); - } - - /** - * @deprecated since 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible. - */ - public function crit($message, array $context = array()) - { - return parent::addRecord(BaseLogger::CRITICAL, $message, $context); - } - - /** - * @deprecated since 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible. - */ - public function err($message, array $context = array()) - { - return parent::addRecord(BaseLogger::ERROR, $message, $context); - } - - /** - * @deprecated since 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible. - */ - public function warn($message, array $context = array()) - { - return parent::addRecord(BaseLogger::WARNING, $message, $context); - } - /** * @see Symfony\Component\HttpKernel\Log\DebugLoggerInterface */ diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php new file mode 100644 index 0000000000000..d03206eb73439 --- /dev/null +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Monolog\Tests; + +use Symfony\Bridge\Monolog\Logger; + +class LoggerTest extends \PHPUnit_Framework_TestCase +{ + public function testGetLogsWithDebugHandler() + { + $expectedLogs = array('foo', 'bar'); + + $debugHandler = $this->getMock('Symfony\Component\HttpKernel\Log\DebugLoggerInterface'); + $debugHandler + ->expects($this->any()) + ->method('getLogs') + ->will($this->returnValue($expectedLogs)) + ; + + $logger = new Logger('foobar', array($debugHandler)); + $this->assertEquals($expectedLogs, $logger->getLogs()); + } + + public function testGetLogsWithoutDebugHandler() + { + $handler = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + + $logger = new Logger('foobar', array($handler)); + $this->assertEquals(array(), $logger->getLogs()); + } + + public function testCountErrorsWithDebugHandler() + { + $debugHandler = $this->getMock('Symfony\Component\HttpKernel\Log\DebugLoggerInterface'); + $debugHandler + ->expects($this->any()) + ->method('countErrors') + ->will($this->returnValue(5)) + ; + + $logger = new Logger('foobar', array($debugHandler)); + $this->assertEquals(5, $logger->countErrors()); + } + + public function testCountErrorsWithoutDebugHandler() + { + $handler = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + + $logger = new Logger('foobar', array($handler)); + $this->assertEquals(0, $logger->countErrors()); + } +} From 91dcca4c2fd4963805c27af8af608d2b62c7e814 Mon Sep 17 00:00:00 2001 From: Philipp Wahala Date: Thu, 4 Dec 2014 19:05:04 +0100 Subject: [PATCH 007/240] [HttpKernel] Remove unused method Kernel::isClassInActiveBundle Follow-up of #11869 --- src/Symfony/Component/HttpKernel/CHANGELOG.md | 1 + src/Symfony/Component/HttpKernel/Kernel.php | 18 ---------- .../Component/HttpKernel/KernelInterface.php | 13 ------- .../Tests/Fixtures/FooBarBundle.php | 19 ----------- .../Component/HttpKernel/Tests/KernelTest.php | 34 ------------------- 5 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index ad32deb12c81e..6b5d21bbc072a 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * Removed `Symfony\Component\HttpKernel\Kernel::init()` +* Removed `Symfony\Component\HttpKernel\Kernel::isClassInActiveBundle()` and `Symfony\Component\HttpKernel\KernelInterface::isClassInActiveBundle()` 2.6.0 ----- diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 5fe3da5d35d50..16bdd195168dc 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -196,24 +196,6 @@ public function getBundles() return $this->bundles; } - /** - * {@inheritdoc} - * - * @api - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. - */ - public function isClassInActiveBundle($class) - { - foreach ($this->getBundles() as $bundle) { - if (0 === strpos($class, $bundle->getNamespace())) { - return true; - } - } - - return false; - } - /** * {@inheritdoc} * diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index 04e5bd640a196..f691ddde8dab8 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -69,19 +69,6 @@ public function shutdown(); */ public function getBundles(); - /** - * Checks if a given class name belongs to an active bundle. - * - * @param string $class A class name - * - * @return bool true if the class belongs to an active bundle, false otherwise - * - * @api - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. - */ - public function isClassInActiveBundle($class); - /** * Returns a bundle and optionally its descendants by its name. * diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php deleted file mode 100644 index f940f83696134..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class FooBarBundle extends Bundle -{ - // We need a full namespaced bundle instance to test isClassInActiveBundle -} diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 96c996528c85c..f8ce7859d01b0 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -17,7 +17,6 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; -use Symfony\Component\HttpKernel\Tests\Fixtures\FooBarBundle; class KernelTest extends \PHPUnit_Framework_TestCase { @@ -279,39 +278,6 @@ public function doStuff() $this->assertEquals($expected, $output); } - public function testIsClassInActiveBundleFalse() - { - $kernel = $this->getKernelMockForIsClassInActiveBundleTest(); - - $this->assertFalse($kernel->isClassInActiveBundle('Not\In\Active\Bundle')); - } - - public function testIsClassInActiveBundleFalseNoNamespace() - { - $kernel = $this->getKernelMockForIsClassInActiveBundleTest(); - - $this->assertFalse($kernel->isClassInActiveBundle('NotNamespacedClass')); - } - - public function testIsClassInActiveBundleTrue() - { - $kernel = $this->getKernelMockForIsClassInActiveBundleTest(); - - $this->assertTrue($kernel->isClassInActiveBundle(__NAMESPACE__.'\Fixtures\FooBarBundle\SomeClass')); - } - - protected function getKernelMockForIsClassInActiveBundleTest() - { - $bundle = new FooBarBundle(); - - $kernel = $this->getKernel(array('getBundles')); - $kernel->expects($this->once()) - ->method('getBundles') - ->will($this->returnValue(array($bundle))); - - return $kernel; - } - public function testGetRootDir() { $kernel = new KernelForTest('test', true); From c70a6166476bd95e3340bff40c0f19e8e3c0fdbe Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Sat, 20 Dec 2014 01:11:36 +0100 Subject: [PATCH 008/240] =?UTF-8?q?[Bridge]=C2=A0[Swiftmailer]=20removes?= =?UTF-8?q?=20Swiftmailer=20bridge=20namespace.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UPGRADE-3.0.md | 3 + composer.json | 1 - src/Symfony/Bridge/Swiftmailer/.gitignore | 3 - src/Symfony/Bridge/Swiftmailer/CHANGELOG.md | 7 -- .../DataCollector/MessageDataCollector.php | 88 ------------------- src/Symfony/Bridge/Swiftmailer/LICENSE | 19 ---- src/Symfony/Bridge/Swiftmailer/composer.json | 35 -------- 7 files changed, 3 insertions(+), 153 deletions(-) delete mode 100644 src/Symfony/Bridge/Swiftmailer/.gitignore delete mode 100644 src/Symfony/Bridge/Swiftmailer/CHANGELOG.md delete mode 100644 src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php delete mode 100644 src/Symfony/Bridge/Swiftmailer/LICENSE delete mode 100644 src/Symfony/Bridge/Swiftmailer/composer.json diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 7dbd53505604b..9b915e75dd05d 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1006,3 +1006,6 @@ UPGRADE FROM 2.x to 3.0 * `Symfony\Bridge\Monolog\Logger::err()` was removed. Use `error()` which is PSR-3 compatible. * `Symfony\Bridge\Monolog\Logger::warn()` was removed. Use `warning()` which is PSR-3 compatible. +### Swiftmailer Bridge + + * `Symfony\Bridge\Swiftmailer\DataCollector\MessageDataCollector` was removed. Use the `Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector` class instead. diff --git a/composer.json b/composer.json index fa875605b20c2..af9c9d4341976 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,6 @@ "symfony/security-bundle": "self.version", "symfony/serializer": "self.version", "symfony/stopwatch": "self.version", - "symfony/swiftmailer-bridge": "self.version", "symfony/templating": "self.version", "symfony/translation": "self.version", "symfony/twig-bridge": "self.version", diff --git a/src/Symfony/Bridge/Swiftmailer/.gitignore b/src/Symfony/Bridge/Swiftmailer/.gitignore deleted file mode 100644 index c49a5d8df5c65..0000000000000 --- a/src/Symfony/Bridge/Swiftmailer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/src/Symfony/Bridge/Swiftmailer/CHANGELOG.md b/src/Symfony/Bridge/Swiftmailer/CHANGELOG.md deleted file mode 100644 index 67100f8b06a5e..0000000000000 --- a/src/Symfony/Bridge/Swiftmailer/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -CHANGELOG -========= - -2.1.0 ------ - - * added a data collector diff --git a/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php b/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php deleted file mode 100644 index 932ac6ef3ef9f..0000000000000 --- a/src/Symfony/Bridge/Swiftmailer/DataCollector/MessageDataCollector.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Swiftmailer\DataCollector; - -use Symfony\Component\HttpKernel\DataCollector\DataCollector; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * MessageDataCollector. - * - * @author Fabien Potencier - * @author Clément JOBEILI - * - * @deprecated Deprecated since version 2.4, to be removed in 3.0. Use - * MessageDataCollector of SwiftmailerBundle instead. - */ -class MessageDataCollector extends DataCollector -{ - private $container; - private $isSpool; - - /** - * Constructor. - * - * We don't inject the message logger and mailer here - * to avoid the creation of these objects when no emails are sent. - * - * @param ContainerInterface $container A ContainerInterface instance - * @param bool $isSpool - */ - public function __construct(ContainerInterface $container, $isSpool) - { - $this->container = $container; - $this->isSpool = $isSpool; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // only collect when Swiftmailer has already been initialized - if (class_exists('Swift_Mailer', false)) { - $logger = $this->container->get('swiftmailer.plugin.messagelogger'); - $this->data['messages'] = $logger->getMessages(); - $this->data['messageCount'] = $logger->countMessages(); - } else { - $this->data['messages'] = array(); - $this->data['messageCount'] = 0; - } - - $this->data['isSpool'] = $this->isSpool; - } - - public function getMessageCount() - { - return $this->data['messageCount']; - } - - public function getMessages() - { - return $this->data['messages']; - } - - public function isSpool() - { - return $this->data['isSpool']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'swiftmailer'; - } -} diff --git a/src/Symfony/Bridge/Swiftmailer/LICENSE b/src/Symfony/Bridge/Swiftmailer/LICENSE deleted file mode 100644 index 0b3292cf90235..0000000000000 --- a/src/Symfony/Bridge/Swiftmailer/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2014 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Symfony/Bridge/Swiftmailer/composer.json b/src/Symfony/Bridge/Swiftmailer/composer.json deleted file mode 100644 index 470dd54f8148d..0000000000000 --- a/src/Symfony/Bridge/Swiftmailer/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "symfony/swiftmailer-bridge", - "type": "symfony-bridge", - "description": "Symfony Swiftmailer Bridge", - "keywords": [], - "homepage": "http://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3", - "swiftmailer/swiftmailer": ">=4.2.0,<6.0-dev" - }, - "suggest": { - "symfony/http-kernel": "" - }, - "autoload": { - "psr-0": { "Symfony\\Bridge\\Swiftmailer\\": "" } - }, - "target-dir": "Symfony/Bridge/Swiftmailer", - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - } -} From 7b33d1a06074bce5c24a758eb53832cc1eb2b9c3 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Wed, 3 Dec 2014 23:04:33 +0100 Subject: [PATCH 009/240] Removed all $that variables --- .../Doctrine/Form/Type/DoctrineType.php | 5 +- .../LazyProxy/PhpDumper/ProxyDumper.php | 5 +- .../LazyProxy/Fixtures/php/lazy_service.php | 5 +- .../Fixtures/php/lazy_service_structure.txt | 7 +- .../LazyProxy/PhpDumper/ProxyDumperTest.php | 6 +- .../Bridge/Twig/Extension/CodeExtension.php | 6 +- .../Templating/Helper/CodeHelper.php | 6 +- .../Translation/PhpStringTokenParser.php | 2 +- .../Controller/PreviewErrorControllerTest.php | 13 +- .../Component/Console/Helper/DialogHelper.php | 12 +- .../Console/Helper/ProcessHelper.php | 13 +- .../Component/Console/Helper/ProgressBar.php | 20 +- .../Console/Helper/QuestionHelper.php | 6 +- .../Component/Console/Input/ArgvInput.php | 7 +- .../Component/Debug/ExceptionHandler.php | 47 +-- .../Debug/Tests/ErrorHandlerTest.php | 56 ++- .../Debug/Tests/ExceptionHandlerTest.php | 10 +- .../DependencyInjection/ContainerBuilder.php | 12 +- .../DependencyInjection/Dumper/PhpDumper.php | 7 +- .../ParameterBag/ParameterBag.php | 8 +- .../Validator/ValidatorTypeGuesser.php | 24 +- .../Component/Form/Tests/CompoundFormTest.php | 41 +- .../Form/Tests/ResolvedFormTypeTest.php | 31 +- .../Component/Form/Tests/SimpleFormTest.php | 21 +- .../Handler/MongoDbSessionHandlerTest.php | 30 +- .../DataCollector/DumpDataCollectorTest.php | 2 +- .../Tests/HttpCache/HttpCacheTest.php | 13 +- .../DateFormat/FullTransformer.php | 16 +- .../Tests/OptionsResolverTest.php | 21 +- .../OptionsResolver/Tests/OptionsTest.php | 54 +-- src/Symfony/Component/Process/Process.php | 7 +- .../Component/Templating/PhpEngine.php | 11 +- .../Templating/Tests/PhpEngineTest.php | 8 +- .../Mapping/ClassMetadataFactoryTest.php | 6 +- .../Tests/Validator/Abstract2Dot5ApiTest.php | 157 ++++---- .../Tests/Validator/AbstractLegacyApiTest.php | 77 ++-- .../Tests/Validator/AbstractValidatorTest.php | 358 +++++++++--------- .../VarDumper/Cloner/AbstractCloner.php | 33 +- src/Symfony/Component/Yaml/Unescaper.php | 5 +- 39 files changed, 497 insertions(+), 671 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index 766d0caad0630..a73cb0986bc45 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -63,11 +63,10 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) $choiceListCache = & $this->choiceListCache; $registry = $this->registry; $propertyAccessor = $this->propertyAccessor; - $type = $this; - $loader = function (Options $options) use ($type) { + $loader = function (Options $options) { if (null !== $options['query_builder']) { - return $type->getLoader($options['em'], $options['query_builder'], $options['class']); + return $this->getLoader($options['em'], $options['query_builder'], $options['class']); } }; diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index d354dde227283..7549596898ecd 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -71,11 +71,10 @@ public function getProxyFactoryCode(Definition $definition, $id) return <<$methodName(false); + function (&\$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface \$proxy) { + \$wrappedInstance = \$this->$methodName(false); \$proxy->setProxyInitializer(null); diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php index b96b8b81a29ca..4e98db2f17fe1 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php @@ -46,11 +46,10 @@ public function __construct() public function getFooService($lazyLoad = true) { if ($lazyLoad) { - $container = $this; return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8( - function (& $wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) { - $wrappedInstance = $container->getFooService(false); + function (& $wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) { + $wrappedInstance = $this->getFooService(false); $proxy->setProxyInitializer(null); diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt index 332370c87eb11..7bd36c13ef6a2 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt @@ -6,11 +6,10 @@ class ProjectServiceContainer extends Container public function getFooService($lazyLoad = true) { if ($lazyLoad) { - $container = $this; return $this->services['foo'] = new stdClass_%s( - function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) { - $wrappedInstance = $container->getFooService(false); + function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) { + $wrappedInstance = $this->getFooService(false); $proxy->setProxyInitializer(null); @@ -24,4 +23,4 @@ class ProjectServiceContainer extends Container } class stdClass_%s extends \stdClass implements \ProxyManager\Proxy\VirtualProxyInterface -{%a}%A \ No newline at end of file +{%a}%A diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index e3ef13d8e9a9f..efb861e9f6767 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -71,10 +71,10 @@ public function testGetProxyFactoryCode() $code = $this->dumper->getProxyFactoryCode($definition, 'foo'); $this->assertStringMatchesFormat( - '%wif ($lazyLoad) {%w$container = $this;%wreturn $this->services[\'foo\'] = new ' + '%wif ($lazyLoad) {%wreturn $this->services[\'foo\'] = new ' .'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction ' - .'(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {' - .'%w$wrappedInstance = $container->getFooService(false);%w$proxy->setProxyInitializer(null);' + .'(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {' + .'%w$wrappedInstance = $this->getFooService(false);%w$proxy->setProxyInitializer(null);' .'%wreturn true;%w}%w);%w}%w', $code ); diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 55a46f2e6f31b..d7b7898a72be4 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -205,10 +205,8 @@ public function getFileLink($file, $line) public function formatFileFromText($text) { - $that = $this; - - return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) use ($that) { - return 'in '.$that->formatFile($match[2], $match[3]); + return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) { + return 'in '.$this->formatFile($match[2], $match[3]); }, $text); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index fe5ae49b2b074..5ee9fb324dea8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -197,10 +197,8 @@ public function getFileLink($file, $line) public function formatFileFromText($text) { - $that = $this; - - return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) use ($that) { - return 'in '.$that->formatFile($match[2], $match[3]); + return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) { + return 'in '.$this->formatFile($match[2], $match[3]); }, $text); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php index 1bb41737637da..df03ea8e20612 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php @@ -106,7 +106,7 @@ public static function parseEscapeSequences($str, $quote) ); } - public static function parseCallback($matches) + private static function parseCallback($matches) { $str = $matches[1]; diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php index 8cb276734e762..ece847feabc6f 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php @@ -21,8 +21,6 @@ class PreviewErrorControllerTest extends TestCase { public function testForwardRequestToConfiguredController() { - $self = $this; - $request = Request::create('whatever'); $response = new Response(""); $code = 123; @@ -33,15 +31,14 @@ public function testForwardRequestToConfiguredController() ->expects($this->once()) ->method('handle') ->with( - $this->callback(function (Request $request) use ($self, $logicalControllerName, $code) { + $this->callback(function (Request $request) use ($logicalControllerName, $code) { - $self->assertEquals($logicalControllerName, $request->attributes->get('_controller')); + $this->assertEquals($logicalControllerName, $request->attributes->get('_controller')); $exception = $request->attributes->get('exception'); - $self->assertInstanceOf('Symfony\Component\Debug\Exception\FlattenException', $exception); - $self->assertEquals($code, $exception->getStatusCode()); - - $self->assertFalse($request->attributes->get('showException')); + $this->assertInstanceOf('Symfony\Component\HttpKernel\Exception\FlattenException', $exception); + $this->assertEquals($code, $exception->getStatusCode()); + $this->assertFalse($request->attributes->get('showException')); return true; }), diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index 64b9f8167c457..5d1a249116a45 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -346,10 +346,8 @@ public function askHiddenResponse(OutputInterface $output, $question, $fallback */ public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null) { - $that = $this; - - $interviewer = function () use ($output, $question, $default, $autocomplete, $that) { - return $that->ask($output, $question, $default, $autocomplete); + $interviewer = function () use ($output, $question, $default, $autocomplete) { + return $this->ask($output, $question, $default, $autocomplete); }; return $this->validateAttempts($interviewer, $output, $validator, $attempts); @@ -376,10 +374,8 @@ public function askAndValidate(OutputInterface $output, $question, $validator, $ */ public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true) { - $that = $this; - - $interviewer = function () use ($output, $question, $fallback, $that) { - return $that->askHiddenResponse($output, $question, $fallback); + $interviewer = function () use ($output, $question, $fallback) { + return $this->askHiddenResponse($output, $question, $fallback); }; return $this->validateAttempts($interviewer, $output, $validator, $attempts); diff --git a/src/Symfony/Component/Console/Helper/ProcessHelper.php b/src/Symfony/Component/Console/Helper/ProcessHelper.php index 0c9da73947623..99970c9b571a0 100644 --- a/src/Symfony/Component/Console/Helper/ProcessHelper.php +++ b/src/Symfony/Component/Console/Helper/ProcessHelper.php @@ -111,10 +111,8 @@ public function wrapCallback(OutputInterface $output, Process $process, $callbac { $formatter = $this->getHelperSet()->get('debug_formatter'); - $that = $this; - - return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) { - $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type)); + return function ($type, $buffer) use ($output, $process, $callback, $formatter) { + $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); if (null !== $callback) { call_user_func($callback, $type, $buffer); @@ -122,12 +120,7 @@ public function wrapCallback(OutputInterface $output, Process $process, $callbac }; } - /** - * This method is public for PHP 5.3 compatibility, it should be private. - * - * @internal - */ - public function escapeString($str) + private function escapeString($str) { return str_replace('<', '\\<', $str); } diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php index 893664e412f54..417ac08195c14 100644 --- a/src/Symfony/Component/Console/Helper/ProgressBar.php +++ b/src/Symfony/Component/Console/Helper/ProgressBar.php @@ -193,11 +193,9 @@ public function getProgress() /** * Gets the progress bar step width. * - * @internal This method is public for PHP 5.3 compatibility, it should not be used. - * - * @return int The progress bar step width + * @return int The progress bar step width */ - public function getStepWidth() + private function getStepWidth() { return $this->stepWidth; } @@ -432,15 +430,11 @@ public function display() return; } - // these 3 variables can be removed in favor of using $this in the closure when support for PHP 5.3 will be dropped. - $self = $this; - $output = $this->output; - $messages = $this->messages; - $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) { - if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) { - $text = call_user_func($formatter, $self, $output); - } elseif (isset($messages[$matches[1]])) { - $text = $messages[$matches[1]]; + $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) { + if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { + $text = call_user_func($formatter, $this, $this->output); + } elseif (isset($this->messages[$matches[1]])) { + $text = $this->messages[$matches[1]]; } else { return $matches[0]; } diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 6a3a22a35e1ed..eeb2c947384bd 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -49,10 +49,8 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu return $this->doAsk($output, $question); } - $that = $this; - - $interviewer = function () use ($output, $question, $that) { - return $that->doAsk($output, $question); + $interviewer = function () use ($output, $question) { + return $this->doAsk($output, $question); }; return $this->validateAttempts($interviewer, $output, $question); diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 68aef1ef6c5f7..0a507bd78cf56 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -333,14 +333,13 @@ public function getParameterOption($values, $default = false) */ public function __toString() { - $self = $this; - $tokens = array_map(function ($token) use ($self) { + $tokens = array_map(function ($token) { if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { - return $match[1].$self->escapeToken($match[2]); + return $match[1].$this->escapeToken($match[2]); } if ($token && $token[0] !== '-') { - return $self->escapeToken($token); + return $this->escapeToken($token); } return $token; diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index 9812729071e47..cbe582eb24068 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -112,13 +112,30 @@ public function handle(\Exception $exception) $caughtLength = $this->caughtLength = 0; - ob_start(array($this, 'catchOutput')); + ob_start(function($buffer) { + $this->caughtBuffer = $buffer; + + return ''; + }); + + $this->failSafeHandle($exception); while (null === $this->caughtBuffer && ob_end_flush()) { // Empty loop, everything is in the condition } if (isset($this->caughtBuffer[0])) { - ob_start(array($this, 'cleanOutput')); + ob_start(function($buffer) { + if ($this->caughtLength) { + // use substr_replace() instead of substr() for mbstring overloading resistance + $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength); + if (isset($cleanBuffer[0])) { + $buffer = $cleanBuffer; + } + } + + return $buffer; + }); + echo $this->caughtBuffer; $caughtLength = ob_get_length(); } @@ -426,30 +443,4 @@ protected static function utf8Htmlize($str) return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8'); } - - /** - * @internal - */ - public function catchOutput($buffer) - { - $this->caughtBuffer = $buffer; - - return ''; - } - - /** - * @internal - */ - public function cleanOutput($buffer) - { - if ($this->caughtLength) { - // use substr_replace() instead of substr() for mbstring overloading resistance - $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength); - if (isset($cleanBuffer[0])) { - $buffer = $cleanBuffer; - } - } - - return $buffer; - } } diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index c0fbb4bd4ae93..3aad901654267 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -237,14 +237,13 @@ public function testHandleError() $logger = $this->getMock('Psr\Log\LoggerInterface'); - $that = $this; - $warnArgCheck = function ($logLevel, $message, $context) use ($that) { - $that->assertEquals('info', $logLevel); - $that->assertEquals('foo', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_USER_DEPRECATED); - $that->assertArrayHasKey('stack', $context); - $that->assertInternalType('array', $context['stack']); + $warnArgCheck = function ($logLevel, $message, $context) { + $this->assertEquals('info', $logLevel); + $this->assertEquals('foo', $message); + $this->assertArrayHasKey('type', $context); + $this->assertEquals($context['type'], E_USER_DEPRECATED); + $this->assertArrayHasKey('stack', $context); + $this->assertInternalType('array', $context['stack']); }; $logger @@ -262,11 +261,10 @@ public function testHandleError() $logger = $this->getMock('Psr\Log\LoggerInterface'); - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Undefined variable: undefVar', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_NOTICE); + $logArgCheck = function ($level, $message, $context) { + $this->assertEquals('Undefined variable: undefVar', $message); + $this->assertArrayHasKey('type', $context); + $this->assertEquals($context['type'], E_NOTICE); }; $logger @@ -300,11 +298,10 @@ public function testHandleException() $logger = $this->getMock('Psr\Log\LoggerInterface'); - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Uncaught Exception: foo', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_ERROR); + $logArgCheck = function ($level, $message, $context){ + $this->assertEquals('Uncaught Exception: foo', $message); + $this->assertArrayHasKey('type', $context); + $this->assertEquals($context['type'], E_ERROR); }; $logger @@ -322,9 +319,8 @@ public function testHandleException() $this->assertSame($exception, $e); } - $that = $this; - $handler->setExceptionHandler(function ($e) use ($exception, $that) { - $that->assertSame($exception, $e); + $handler->setExceptionHandler(function ($e) use ($exception) { + $this->assertSame($exception, $e); }); $handler->handleException($exception); @@ -353,11 +349,10 @@ public function testHandleFatalError() $logger = $this->getMock('Psr\Log\LoggerInterface'); - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Fatal Parse Error: foo', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_ERROR); + $logArgCheck = function ($level, $message, $context) { + $this->assertEquals('Fatal Parse Error: foo', $message); + $this->assertArrayHasKey('type', $context); + $this->assertEquals($context['type'], E_ERROR); }; $logger @@ -391,11 +386,10 @@ public function testDeprecatedInterface() $logger = $this->getMock('Psr\Log\LoggerInterface'); - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Undefined variable: undefVar', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_NOTICE); + $logArgCheck = function ($level, $message, $context) { + $this->assertEquals('Undefined variable: undefVar', $message); + $this->assertArrayHasKey('type', $context); + $this->assertEquals($context['type'], E_NOTICE); }; $logger diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index 26f889288ff93..e59671c1a8d7b 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -81,9 +81,8 @@ public function testHandle() $handler->handle($exception); - $that = $this; - $handler->setHandler(function ($e) use ($exception, $that) { - $that->assertSame($exception, $e); + $handler->setHandler(function ($e) use ($exception) { + $this->assertSame($exception, $e); }); $handler->handle($exception); @@ -106,9 +105,8 @@ public function testHandleOutOfMemoryException() ->method('sendPhpResponse'); } - $that = $this; - $handler->setHandler(function ($e) use ($that) { - $that->fail('OutOfMemoryException should bypass the handler'); + $handler->setHandler(function ($e) { + $this->fail('OutOfMemoryException should bypass the handler'); }); $handler->handle($exception); diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 3f945d157fdb1..fe4a95113564c 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -907,25 +907,21 @@ public function findDefinition($id) * @throws RuntimeException When the factory definition is incomplete * @throws RuntimeException When the service is a synthetic service * @throws InvalidArgumentException When configure callable is not callable - * - * @internal this method is public because of PHP 5.3 limitations, do not use it explicitly in your code */ - public function createService(Definition $definition, $id, $tryProxy = true) + private function createService(Definition $definition, $id, $tryProxy = true) { if ($definition->isSynthetic()) { throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id)); } if ($tryProxy && $definition->isLazy()) { - $container = $this; - $proxy = $this ->getProxyInstantiator() ->instantiateProxy( - $container, + $this, $definition, - $id, function () use ($definition, $id, $container) { - return $container->createService($definition, $id, false); + $id, function () use ($definition, $id) { + return $this->createService($definition, $id, false); } ); $this->shareService($definition, $proxy, $id); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 065eead61707c..24e6045a0d9de 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1355,9 +1355,8 @@ private function dumpValue($value, $interpolate = true) // the preg_replace_callback converts them to strings return $this->dumpParameter(strtolower($match[1])); } else { - $that = $this; - $replaceParameters = function ($match) use ($that) { - return "'.".$that->dumpParameter(strtolower($match[2])).".'"; + $replaceParameters = function ($match) { + return "'.".$this->dumpParameter(strtolower($match[2])).".'"; }; $code = str_replace('%%', '%', preg_replace_callback('/(?export($value))); @@ -1390,7 +1389,7 @@ private function dumpLiteralClass($class) * * @return string */ - public function dumpParameter($name) + private function dumpParameter($name) { if ($this->container->isFrozen() && $this->container->hasParameter($name)) { return $this->dumpValue($this->container->getParameter($name), false); diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index 12cc4810d1725..99853e72ec3b6 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -232,9 +232,7 @@ public function resolveString($value, array $resolving = array()) return $this->resolved ? $this->get($key) : $this->resolveValue($this->get($key), $resolving); } - $self = $this; - - return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($self, $resolving, $value) { + return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($resolving, $value) { // skip %% if (!isset($match[1])) { return '%%'; @@ -245,7 +243,7 @@ public function resolveString($value, array $resolving = array()) throw new ParameterCircularReferenceException(array_keys($resolving)); } - $resolved = $self->get($key); + $resolved = $this->get($key); if (!is_string($resolved) && !is_numeric($resolved)) { throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type %s inside string value "%s".', $key, gettype($resolved), $value)); @@ -254,7 +252,7 @@ public function resolveString($value, array $resolving = array()) $resolved = (string) $resolved; $resolving[$key] = true; - return $self->isResolved() ? $resolved : $self->resolveString($resolved, $resolving); + return $this->isResolved() ? $resolved : $this->resolveString($resolved, $resolving); }, $value); } diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index f0b0ac5c36638..dd87d73fad469 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -33,10 +33,8 @@ public function __construct(MetadataFactoryInterface $metadataFactory) */ public function guessType($class, $property) { - $guesser = $this; - - return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) { - return $guesser->guessTypeForConstraint($constraint); + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessTypeForConstraint($constraint); }); } @@ -45,10 +43,8 @@ public function guessType($class, $property) */ public function guessRequired($class, $property) { - $guesser = $this; - - return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) { - return $guesser->guessRequiredForConstraint($constraint); + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessRequiredForConstraint($constraint); // If we don't find any constraint telling otherwise, we can assume // that a field is not required (with LOW_CONFIDENCE) }, false); @@ -59,10 +55,8 @@ public function guessRequired($class, $property) */ public function guessMaxLength($class, $property) { - $guesser = $this; - - return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) { - return $guesser->guessMaxLengthForConstraint($constraint); + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessMaxLengthForConstraint($constraint); }); } @@ -71,10 +65,8 @@ public function guessMaxLength($class, $property) */ public function guessPattern($class, $property) { - $guesser = $this; - - return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) { - return $guesser->guessPatternForConstraint($constraint); + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessPatternForConstraint($constraint); }); } diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index 9bb2528c6eb09..07482648623f0 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -316,7 +316,6 @@ public function testIterator() public function testAddMapsViewDataToFormIfInitialized() { - $test = $this; $mapper = $this->getDataMapper(); $form = $this->getBuilder() ->setCompound(true) @@ -332,9 +331,9 @@ public function testAddMapsViewDataToFormIfInitialized() $mapper->expects($this->once()) ->method('mapDataToForms') ->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator')) - ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child, $test) { - $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); - $test->assertSame(array($child), iterator_to_array($iterator)); + ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child) { + $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); + $this->assertSame(array($child), iterator_to_array($iterator)); })); $form->initialize(); @@ -410,7 +409,6 @@ public function testSetDataSupportsDynamicAdditionAndRemovalOfChildren() public function testSetDataMapsViewDataToChildren() { - $test = $this; $mapper = $this->getDataMapper(); $form = $this->getBuilder() ->setCompound(true) @@ -427,9 +425,9 @@ public function testSetDataMapsViewDataToChildren() $mapper->expects($this->once()) ->method('mapDataToForms') ->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator')) - ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2, $test) { - $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); - $test->assertSame(array('firstName' => $child1, 'lastName' => $child2), iterator_to_array($iterator)); + ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2) { + $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); + $this->assertSame(array('firstName' => $child1, 'lastName' => $child2), iterator_to_array($iterator)); })); $form->setData('foo'); @@ -465,7 +463,6 @@ public function testSubmitSupportsDynamicAdditionAndRemovalOfChildren() public function testSubmitMapsSubmittedChildrenOntoExistingViewData() { - $test = $this; $mapper = $this->getDataMapper(); $form = $this->getBuilder() ->setCompound(true) @@ -483,11 +480,11 @@ public function testSubmitMapsSubmittedChildrenOntoExistingViewData() $mapper->expects($this->once()) ->method('mapFormsToData') ->with($this->isInstanceOf('\RecursiveIteratorIterator'), 'bar') - ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2, $test) { - $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); - $test->assertSame(array('firstName' => $child1, 'lastName' => $child2), iterator_to_array($iterator)); - $test->assertEquals('Bernhard', $child1->getData()); - $test->assertEquals('Schussek', $child2->getData()); + ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2) { + $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); + $this->assertSame(array('firstName' => $child1, 'lastName' => $child2), iterator_to_array($iterator)); + $this->assertEquals('Bernhard', $child1->getData()); + $this->assertEquals('Schussek', $child2->getData()); })); $form->submit(array( @@ -541,7 +538,6 @@ public function testSubmitRestoresViewDataIfCompoundAndEmpty() public function testSubmitMapsSubmittedChildrenOntoEmptyData() { - $test = $this; $mapper = $this->getDataMapper(); $object = new \stdClass(); $form = $this->getBuilder() @@ -556,9 +552,9 @@ public function testSubmitMapsSubmittedChildrenOntoEmptyData() $mapper->expects($this->once()) ->method('mapFormsToData') ->with($this->isInstanceOf('\RecursiveIteratorIterator'), $object) - ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child, $test) { - $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); - $test->assertSame(array('name' => $child), iterator_to_array($iterator)); + ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child) { + $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); + $this->assertSame(array('name' => $child), iterator_to_array($iterator)); })); $form->submit(array( @@ -919,12 +915,9 @@ public function testCreateViewWithChildren() $this->form->add($field1); $this->form->add($field2); - $test = $this; - - $assertChildViewsEqual = function (array $childViews) use ($test) { - return function (FormView $view) use ($test, $childViews) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertSame($childViews, $view->children); + $assertChildViewsEqual = function (array $childViews) { + return function (FormView $view) use ($childViews) { + $this->assertSame($childViews, $view->children); }; }; diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index d1982c1c23036..1000c521b4030 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -62,13 +62,11 @@ public function testGetOptionsResolver() $this->markTestSkipped('This test requires PHPUnit 3.7.'); } - $test = $this; $i = 0; - $assertIndexAndAddOption = function ($index, $option, $default) use (&$i, $test) { - return function (OptionsResolverInterface $resolver) use (&$i, $test, $index, $option, $default) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals($index, $i, 'Executed at index '.$index); + $assertIndexAndAddOption = function ($index, $option, $default) use (&$i) { + return function (OptionsResolverInterface $resolver) use (&$i, $index, $option, $default) { + $this->assertEquals($index, $i, 'Executed at index '.$index); ++$i; @@ -173,13 +171,11 @@ public function testBuildForm() $this->markTestSkipped('This test requires PHPUnit 3.7.'); } - $test = $this; $i = 0; - $assertIndex = function ($index) use (&$i, $test) { - return function () use (&$i, $test, $index) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals($index, $i, 'Executed at index '.$index); + $assertIndex = function ($index) use (&$i) { + return function () use (&$i, $index) { + $this->assertEquals($index, $i, 'Executed at index '.$index); ++$i; }; @@ -241,13 +237,11 @@ public function testBuildView() $form = $this->getMock('Symfony\Component\Form\Test\FormInterface'); $view = $this->getMock('Symfony\Component\Form\FormView'); - $test = $this; $i = 0; - $assertIndex = function ($index) use (&$i, $test) { - return function () use (&$i, $test, $index) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals($index, $i, 'Executed at index '.$index); + $assertIndex = function ($index) use (&$i) { + return function () use (&$i, $index) { + $this->assertEquals($index, $i, 'Executed at index '.$index); ++$i; }; @@ -285,13 +279,12 @@ public function testFinishView() $form = $this->getMock('Symfony\Component\Form\Test\FormInterface'); $view = $this->getMock('Symfony\Component\Form\FormView'); - $test = $this; $i = 0; - $assertIndex = function ($index) use (&$i, $test) { - return function () use (&$i, $test, $index) { + $assertIndex = function ($index) use (&$i) { + return function () use (&$i, $index) { /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals($index, $i, 'Executed at index '.$index); + $this->assertEquals($index, $i, 'Executed at index '.$index); ++$i; }; diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 6cebba753802c..21d9848f9018c 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -654,12 +654,11 @@ public function testEmptyDataCreatedBeforeTransforming() public function testEmptyDataFromClosure() { - $test = $this; $form = $this->getBuilder() - ->setEmptyData(function ($form) use ($test) { + ->setEmptyData(function ($form) { // the form instance is passed to the closure to allow use // of form data when creating the empty value - $test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form); + $this->assertInstanceOf('Symfony\Component\Form\FormInterface', $form); return 'foo'; }) @@ -899,12 +898,10 @@ public function testSetDataCannotInvokeItself() public function testSubmittingWrongDataIsIgnored() { - $test = $this; - $child = $this->getBuilder('child', $this->dispatcher); - $child->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($test) { + $child->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { // child form doesn't receive the wrong data that is submitted on parent - $test->assertNull($event->getData()); + $this->assertNull($event->getData()); }); $parent = $this->getBuilder('parent', new EventDispatcher()) @@ -1004,10 +1001,9 @@ public function testGetViewDataRequiresParentToBeSetIfInheritData() public function testPostSubmitDataIsNullIfInheritData() { - $test = $this; $form = $this->getBuilder() - ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($test) { - $test->assertNull($event->getData()); + ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { + $this->assertNull($event->getData()); }) ->setInheritData(true) ->getForm(); @@ -1017,10 +1013,9 @@ public function testPostSubmitDataIsNullIfInheritData() public function testSubmitIsNeverFiredIfInheritData() { - $test = $this; $form = $this->getBuilder() - ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use ($test) { - $test->fail('The SUBMIT event should not be fired'); + ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) { + $this->fail('The SUBMIT event should not be fired'); }) ->setInheritData(true) ->getForm(); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 63d6d1e92383d..254dc846085f9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -82,14 +82,13 @@ public function testWrite() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $that = $this; $data = array(); $collection->expects($this->once()) ->method('update') - ->will($this->returnCallback(function ($criteria, $updateData, $options) use ($that, &$data) { - $that->assertEquals(array($that->options['id_field'] => 'foo'), $criteria); - $that->assertEquals(array('upsert' => true, 'multiple' => false), $options); + ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { + $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); + $this->assertEquals(array('upsert' => true, 'multiple' => false), $options); $data = $updateData['$set']; })); @@ -97,7 +96,7 @@ public function testWrite() $this->assertTrue($this->storage->write('foo', 'bar')); $this->assertEquals('bar', $data[$this->options['data_field']]->bin); - $that->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); + $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); } public function testWriteWhenUsingExpiresField() @@ -120,14 +119,13 @@ public function testWriteWhenUsingExpiresField() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $that = $this; $data = array(); $collection->expects($this->once()) ->method('update') - ->will($this->returnCallback(function ($criteria, $updateData, $options) use ($that, &$data) { - $that->assertEquals(array($that->options['id_field'] => 'foo'), $criteria); - $that->assertEquals(array('upsert' => true, 'multiple' => false), $options); + ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { + $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); + $this->assertEquals(array('upsert' => true, 'multiple' => false), $options); $data = $updateData['$set']; })); @@ -135,8 +133,8 @@ public function testWriteWhenUsingExpiresField() $this->assertTrue($this->storage->write('foo', 'bar')); $this->assertEquals('bar', $data[$this->options['data_field']]->bin); - $that->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); - $that->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]); + $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); + $this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]); } public function testReplaceSessionData() @@ -187,13 +185,11 @@ public function testGc() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $that = $this; - $collection->expects($this->once()) ->method('remove') - ->will($this->returnCallback(function ($criteria) use ($that) { - $that->assertInstanceOf('MongoDate', $criteria[$that->options['time_field']]['$lt']); - $that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['time_field']]['$lt']->sec); + ->will($this->returnCallback(function ($criteria) { + $this->assertInstanceOf('MongoDate', $criteria[$this->options['time_field']]['$lt']); + $this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['time_field']]['$lt']->sec); })); $this->assertTrue($this->storage->gc(1)); @@ -217,8 +213,6 @@ public function testGcWhenUsingExpiresField() $this->mongo->expects($this->never()) ->method('selectCollection'); - $that = $this; - $collection->expects($this->never()) ->method('remove'); diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index 5c8fdb6ed1788..9272bed3ef567 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -47,7 +47,7 @@ public function testDump() 'fileExcerpt' => false, ), ); - $this->assertSame($xDump, $dump); + $this->assertEquals($xDump, $dump); $this->assertStringStartsWith( 'a:1:{i:0;a:5:{s:4:"data";O:39:"Symfony\Component\VarDumper\Cloner\Data":4:{s:45:"Symfony\Component\VarDumper\Cloner\Datadata";a:1:{i:0;a:1:{i:0;i:123;}}s:49:"Symfony\Component\VarDumper\Cloner\DatamaxDepth";i:-1;s:57:"Symfony\Component\VarDumper\Cloner\DatamaxItemsPerDepth";i:-1;s:54:"Symfony\Component\VarDumper\Cloner\DatauseRefHandles";i:-1;}s:4:"name";s:25:"DumpDataCollectorTest.php";s:4:"file";s:', diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 7da3030edb526..a99d66fdfa6c4 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -850,11 +850,10 @@ public function testReplacesCachedResponsesWhenValidationResultsInNon304Response public function testPassesHeadRequestsThroughDirectlyOnPass() { - $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { $response->setContent(''); $response->setStatusCode(200); - $that->assertEquals('HEAD', $request->getMethod()); + $this->assertEquals('HEAD', $request->getMethod()); }); $this->request('HEAD', '/', array('HTTP_EXPECT' => 'something ...')); @@ -864,12 +863,11 @@ public function testPassesHeadRequestsThroughDirectlyOnPass() public function testUsesCacheToRespondToHeadRequestsWhenFresh() { - $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->setContent('Hello World'); $response->setStatusCode(200); - $that->assertNotEquals('HEAD', $request->getMethod()); + $this->assertNotEquals('HEAD', $request->getMethod()); }); $this->request('GET', '/'); @@ -886,8 +884,7 @@ public function testUsesCacheToRespondToHeadRequestsWhenFresh() public function testSendsNoContentWhenFresh() { $time = \DateTime::createFromFormat('U', time()); - $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php index d3ca9451b37a7..329eef31297ee 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php @@ -88,10 +88,8 @@ public function getTransformers() */ public function format(\DateTime $dateTime) { - $that = $this; - - $formatted = preg_replace_callback($this->regExp, function ($matches) use ($that, $dateTime) { - return $that->formatReplace($matches[0], $dateTime); + $formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) { + return $this->formatReplace($matches[0], $dateTime); }, $this->pattern); return $formatted; @@ -176,24 +174,22 @@ public function parse(\DateTime $dateTime, $value) */ public function getReverseMatchingRegExp($pattern) { - $that = $this; - $escapedPattern = preg_quote($pattern, '/'); // ICU 4.8 recognizes slash ("/") in a value to be parsed as a dash ("-") and vice-versa // when parsing a date/time value $escapedPattern = preg_replace('/\\\[\-|\/]/', '[\/\-]', $escapedPattern); - $reverseMatchingRegExp = preg_replace_callback($this->regExp, function ($matches) use ($that) { + $reverseMatchingRegExp = preg_replace_callback($this->regExp, function ($matches) { $length = strlen($matches[0]); $transformerIndex = $matches[0][0]; $dateChars = $matches[0]; - if ($that->isQuoteMatch($dateChars)) { - return $that->replaceQuoteMatch($dateChars); + if ($this->isQuoteMatch($dateChars)) { + return $this->replaceQuoteMatch($dateChars); } - $transformers = $that->getTransformers(); + $transformers = $this->getTransformers(); if (isset($transformers[$transformerIndex])) { $transformer = $transformers[$transformerIndex]; $captureName = str_repeat($transformerIndex, $length); diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php index 064487ff68556..9becb4c8e005a 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php @@ -99,16 +99,13 @@ public function testResolveLazyDependencyOnOptional() public function testResolveLazyDependencyOnMissingOptionalWithoutDefault() { - $test = $this; - $this->resolver->setOptional(array( 'one', )); $this->resolver->setDefaults(array( - 'two' => function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertFalse(isset($options['one'])); + 'two' => function (Options $options) { + $this->assertFalse(isset($options['one'])); return '2'; }, @@ -123,16 +120,13 @@ public function testResolveLazyDependencyOnMissingOptionalWithoutDefault() public function testResolveLazyDependencyOnOptionalWithoutDefault() { - $test = $this; - $this->resolver->setOptional(array( 'one', )); $this->resolver->setDefaults(array( - 'two' => function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertTrue(isset($options['one'])); + 'two' => function (Options $options) { + $this->assertTrue(isset($options['one'])); return $options['one'].'2'; }, @@ -171,12 +165,9 @@ public function testResolveLazyDependencyOnRequired() public function testResolveLazyReplaceDefaults() { - $test = $this; - $this->resolver->setDefaults(array( - 'one' => function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->fail('Previous closure should not be executed'); + 'one' => function (Options $options) { + $this->fail('Previous closure should not be executed'); }, )); diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php index 5d569ebe02bd7..d3c9958ec1998 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php @@ -31,9 +31,7 @@ protected function setUp() public function testSetLazyOption() { - $test = $this; - - $this->options->set('foo', function (Options $options) use ($test) { + $this->options->set('foo', function (Options $options) { return 'dynamic'; }); @@ -42,15 +40,12 @@ public function testSetLazyOption() public function testOverloadKeepsPreviousValue() { - $test = $this; - // defined by superclass $this->options->set('foo', 'bar'); // defined by subclass - $this->options->overload('foo', function (Options $options, $previousValue) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals('bar', $previousValue); + $this->options->overload('foo', function (Options $options, $previousValue) { + $this->assertEquals('bar', $previousValue); return 'dynamic'; }); @@ -60,17 +55,14 @@ public function testOverloadKeepsPreviousValue() public function testPreviousValueIsEvaluatedIfLazy() { - $test = $this; - // defined by superclass $this->options->set('foo', function (Options $options) { return 'bar'; }); // defined by subclass - $this->options->overload('foo', function (Options $options, $previousValue) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals('bar', $previousValue); + $this->options->overload('foo', function (Options $options, $previousValue) { + $this->assertEquals('bar', $previousValue); return 'dynamic'; }); @@ -80,15 +72,13 @@ public function testPreviousValueIsEvaluatedIfLazy() public function testPreviousValueIsNotEvaluatedIfNoSecondArgument() { - $test = $this; - // defined by superclass - $this->options->set('foo', function (Options $options) use ($test) { - $test->fail('Should not be called'); + $this->options->set('foo', function (Options $options) { + $this->fail('Should not be called'); }); // defined by subclass, no $previousValue argument defined! - $this->options->overload('foo', function (Options $options) use ($test) { + $this->options->overload('foo', function (Options $options) { return 'dynamic'; }); @@ -97,13 +87,10 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument() public function testLazyOptionCanAccessOtherOptions() { - $test = $this; - $this->options->set('foo', 'bar'); - $this->options->set('bam', function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals('bar', $options->get('foo')); + $this->options->set('bam', function (Options $options) { + $this->assertEquals('bar', $options->get('foo')); return 'dynamic'; }); @@ -113,15 +100,12 @@ public function testLazyOptionCanAccessOtherOptions() public function testLazyOptionCanAccessOtherLazyOptions() { - $test = $this; - $this->options->set('foo', function (Options $options) { return 'bar'; }); - $this->options->set('bam', function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals('bar', $options->get('foo')); + $this->options->set('bam', function (Options $options) { + $this->assertEquals('bar', $options->get('foo')); return 'dynamic'; }); @@ -153,14 +137,11 @@ public function testNormalizerReceivesUnnormalizedValue() public function testNormalizerCanAccessOtherOptions() { - $test = $this; - $this->options->set('foo', 'bar'); $this->options->set('bam', 'baz'); - $this->options->setNormalizer('bam', function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals('bar', $options->get('foo')); + $this->options->setNormalizer('bam', function (Options $options) { + $this->assertEquals('bar', $options->get('foo')); return 'normalized'; }); @@ -170,16 +151,13 @@ public function testNormalizerCanAccessOtherOptions() public function testNormalizerCanAccessOtherLazyOptions() { - $test = $this; - $this->options->set('foo', function (Options $options) { return 'bar'; }); $this->options->set('bam', 'baz'); - $this->options->setNormalizer('bam', function (Options $options) use ($test) { - /* @var \PHPUnit_Framework_TestCase $test */ - $test->assertEquals('bar', $options->get('foo')); + $this->options->setNormalizer('bam', function (Options $options) { + $this->assertEquals('bar', $options->get('foo')); return 'normalized'; }); diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index c1181ef92eb47..264312289f952 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1247,14 +1247,13 @@ private function getDescriptors() */ protected function buildCallback($callback) { - $that = $this; $out = self::OUT; $err = self::ERR; - $callback = function ($type, $data) use ($that, $callback, $out, $err) { + $callback = function ($type, $data) use ($callback, $out, $err) { if ($out == $type) { - $that->addOutput($data); + $this->addOutput($data); } else { - $that->addErrorOutput($data); + $this->addErrorOutput($data); } if (null !== $callback) { diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index db901b8cad261..60da1350cbce5 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -457,7 +457,6 @@ public function getGlobals() */ protected function initializeEscapers() { - $that = $this; if (PHP_VERSION_ID >= 50400) { $flags = ENT_QUOTES | ENT_SUBSTITUTE; } else { @@ -473,10 +472,10 @@ protected function initializeEscapers() * * @return string the escaped value */ - function ($value) use ($that, $flags) { + function ($value) use ($flags) { // Numbers and Boolean values get turned into strings which can cause problems // with type comparisons (e.g. === or is_int() etc). - return is_string($value) ? htmlspecialchars($value, $flags, $that->getCharset(), false) : $value; + return is_string($value) ? htmlspecialchars($value, $flags, $this->getCharset(), false) : $value; }, 'js' => @@ -487,7 +486,7 @@ function ($value) use ($that, $flags) { * @param string $value the value to escape * @return string the escaped value */ - function ($value) use ($that) { + function ($value) { if ('UTF-8' != $that->getCharset()) { $value = $that->convertEncoding($value, 'UTF-8', $that->getCharset()); } @@ -510,8 +509,8 @@ function ($value) use ($that) { throw new \InvalidArgumentException('The string to escape is not a valid UTF-8 string.'); } - if ('UTF-8' != $that->getCharset()) { - $value = $that->convertEncoding($value, $that->getCharset(), 'UTF-8'); + if ('UTF-8' != $this->getCharset()) { + $value = $this->convertEncoding($value, $that->getCharset(), 'UTF-8'); } return $value; diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php index fa0134aae1a9e..6fbfdb511fbee 100644 --- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php @@ -103,15 +103,15 @@ public function testExtendRender() $engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader, array(new SlotsHelper())); $engine->set(new \Symfony\Component\Templating\Tests\Fixtures\SimpleHelper('bar')); - $this->loader->setTemplate('foo.php', 'extend("layout.php"); echo $view[\'foo\'].$foo ?>'); - $this->loader->setTemplate('layout.php', '-get("_content") ?>-'); + $this->loader->setTemplate('foo.php', 'extend("layout.php"); echo $this[\'foo\'].$foo ?>'); + $this->loader->setTemplate('layout.php', '-get("_content") ?>-'); $this->assertEquals('-barfoo-', $engine->render('foo.php', array('foo' => 'foo')), '->render() uses the decorator to decorate the template'); $engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader, array(new SlotsHelper())); $engine->set(new \Symfony\Component\Templating\Tests\Fixtures\SimpleHelper('bar')); $this->loader->setTemplate('bar.php', 'bar'); - $this->loader->setTemplate('foo.php', 'extend("layout.php"); echo $foo ?>'); - $this->loader->setTemplate('layout.php', 'render("bar.php") ?>-get("_content") ?>-'); + $this->loader->setTemplate('foo.php', 'extend("layout.php"); echo $foo ?>'); + $this->loader->setTemplate('layout.php', 'render("bar.php") ?>-get("_content") ?>-'); $this->assertEquals('bar-foo-', $engine->render('foo.php', array('foo' => 'foo', 'bar' => 'bar')), '->render() supports render() calls in templates'); } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataFactoryTest.php index b55985292d503..f54547ca18c3a 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataFactoryTest.php @@ -63,7 +63,6 @@ public function testWriteMetadataToCache() $cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface'); $factory = new ClassMetadataFactory(new TestLoader(), $cache); - $tester = $this; $constraints = array( new ConstraintA(array('groups' => array('Default', 'EntityParent'))), ); @@ -76,8 +75,8 @@ public function testWriteMetadataToCache() ->will($this->returnValue(false)); $cache->expects($this->once()) ->method('write') - ->will($this->returnCallback(function ($metadata) use ($tester, $constraints) { - $tester->assertEquals($constraints, $metadata->getConstraints()); + ->will($this->returnCallback(function ($metadata) use ($constraints) { + $this->assertEquals($constraints, $metadata->getConstraints()); })); $metadata = $factory->getMetadataFor(self::PARENTCLASS); @@ -92,7 +91,6 @@ public function testReadMetadataFromCache() $cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface'); $factory = new ClassMetadataFactory($loader, $cache); - $tester = $this; $metadata = new ClassMetadata(self::PARENTCLASS); $metadata->addConstraint(new ConstraintA()); diff --git a/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php index c214b9c07bc5a..9bbaffcf81425 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php @@ -139,11 +139,10 @@ public function testGroupSequenceIncludesReferences() public function testValidateInSeparateContext() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $callback1 = function ($value, ExecutionContextInterface $context) use ($entity) { $violations = $context ->getValidator() // Since the validator is not context aware, the group must @@ -152,30 +151,30 @@ public function testValidateInSeparateContext() ; /** @var ConstraintViolationInterface[] $violations */ - $test->assertCount(1, $violations); - $test->assertSame('Message value', $violations[0]->getMessage()); - $test->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $test->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $test->assertSame('', $violations[0]->getPropertyPath()); + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); + $this->assertSame('', $violations[0]->getPropertyPath()); // The root is different as we're in a new context - $test->assertSame($entity->reference, $violations[0]->getRoot()); - $test->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $test->assertNull($violations[0]->getMessagePluralization()); - $test->assertNull($violations[0]->getCode()); + $this->assertSame($entity->reference, $violations[0]->getRoot()); + $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getMessagePluralization()); + $this->assertNull($violations[0]->getCode()); // Verify that this method is called $context->addViolation('Separate violation'); }; - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity->reference, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); + $callback2 = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity->reference, $context->getRoot()); + $this->assertSame($entity->reference, $context->getValue()); + $this->assertSame($entity->reference, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -193,16 +192,15 @@ public function testValidateInSeparateContext() /** @var ConstraintViolationInterface[] $violations */ $this->assertCount(1, $violations); - $test->assertSame('Separate violation', $violations[0]->getMessage()); + $this->assertSame('Separate violation', $violations[0]->getMessage()); } public function testValidateInContext() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $callback1 = function ($value, ExecutionContextInterface $context) { $previousValue = $context->getValue(); $previousObject = $context->getObject(); $previousMetadata = $context->getMetadata(); @@ -217,22 +215,22 @@ public function testValidateInContext() ; // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousObject, $context->getObject()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); + $this->assertSame($previousValue, $context->getValue()); + $this->assertSame($previousObject, $context->getObject()); + $this->assertSame($previousMetadata, $context->getMetadata()); + $this->assertSame($previousPath, $context->getPropertyPath()); + $this->assertSame($previousGroup, $context->getGroup()); }; - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); + $callback2 = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('subpath', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference, $context->getValue()); + $this->assertSame($entity->reference, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -262,11 +260,10 @@ public function testValidateInContext() public function testValidateArrayInContext() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $callback1 = function ($value, ExecutionContextInterface $context) { $previousValue = $context->getValue(); $previousObject = $context->getObject(); $previousMetadata = $context->getMetadata(); @@ -281,22 +278,22 @@ public function testValidateArrayInContext() ; // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousObject, $context->getObject()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); + $this->assertSame($previousValue, $context->getValue()); + $this->assertSame($previousObject, $context->getObject()); + $this->assertSame($previousMetadata, $context->getMetadata()); + $this->assertSame($previousPath, $context->getPropertyPath()); + $this->assertSame($previousGroup, $context->getGroup()); }; - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); + $callback2 = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('subpath[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference, $context->getValue()); + $this->assertSame($entity->reference, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -326,19 +323,18 @@ public function testValidateArrayInContext() public function testTraverseTraversableByDefault() { - $test = $this; $entity = new Entity(); $traversable = new \ArrayIterator(array('key' => $entity)); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($traversable, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity, $traversable) { + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->metadata, $context->getMetadata()); + $this->assertSame($traversable, $context->getRoot()); + $this->assertSame($entity, $context->getValue()); + $this->assertSame($entity, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -389,12 +385,11 @@ public function testTraversalEnabledOnClass() public function testTraversalDisabledOnClass() { - $test = $this; $entity = new Entity(); $traversable = new \ArrayIterator(array('key' => $entity)); - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); + $callback = function ($value, ExecutionContextInterface $context) { + $this->fail('Should not be called'); }; $traversableMetadata = new ClassMetadata('ArrayIterator'); @@ -426,12 +421,11 @@ public function testExpectTraversableIfTraversalEnabledOnClass() public function testReferenceTraversalDisabledOnClass() { - $test = $this; $entity = new Entity(); $entity->reference = new \ArrayIterator(array('key' => new Reference())); - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); + $callback = function ($value, ExecutionContextInterface $context) { + $this->fail('Should not be called'); }; $traversableMetadata = new ClassMetadata('ArrayIterator'); @@ -452,12 +446,11 @@ public function testReferenceTraversalDisabledOnClass() public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() { - $test = $this; $entity = new Entity(); $entity->reference = new \ArrayIterator(array('key' => new Reference())); - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); + $callback = function ($value, ExecutionContextInterface $context) { + $this->fail('Should not be called'); }; $traversableMetadata = new ClassMetadata('ArrayIterator'); @@ -480,12 +473,11 @@ public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() public function testReferenceTraversalDisabledOnReferenceEnabledOnClass() { - $test = $this; $entity = new Entity(); $entity->reference = new \ArrayIterator(array('key' => new Reference())); - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); + $callback = function ($value, ExecutionContextInterface $context) { + $this->fail('Should not be called'); }; $traversableMetadata = new ClassMetadata('ArrayIterator'); @@ -537,14 +529,13 @@ public function testReferenceTraversalRecursionEnabledOnReferenceTraversalEnable public function testReferenceTraversalRecursionDisabledOnReferenceTraversalEnabledOnClass() { - $test = $this; $entity = new Entity(); $entity->reference = new \ArrayIterator(array( 2 => new \ArrayIterator(array('key' => new Reference())), )); - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); + $callback = function ($value, ExecutionContextInterface $context) { + $this->fail('Should not be called'); }; $traversableMetadata = new ClassMetadata('ArrayIterator'); @@ -696,14 +687,13 @@ public function testValidateFailsIfNoConstraintsAndNoObjectOrArray() public function testAccessCurrentObject() { - $test = $this; $called = false; $entity = new Entity(); $entity->firstName = 'Bernhard'; - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, &$called) { + $callback = function ($value, ExecutionContextInterface $context) use ($entity, &$called) { $called = true; - $test->assertSame($entity, $context->getObject()); + $this->assertSame($entity, $context->getObject()); }; $this->metadata->addConstraint(new Callback($callback)); @@ -716,7 +706,6 @@ public function testAccessCurrentObject() public function testInitializeObjectsOnFirstValidation() { - $test = $this; $entity = new Entity(); $entity->initialized = false; @@ -743,8 +732,8 @@ public function testInitializeObjectsOnFirstValidation() // prepare constraint which // * checks that "initialized" is set to true // * validates the object again - $callback = function ($object, ExecutionContextInterface $context) use ($test) { - $test->assertTrue($object->initialized); + $callback = function ($object, ExecutionContextInterface $context) { + $this->assertTrue($object->initialized); // validate again in same group $validator = $context->getValidator()->inContext($context); diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php index 748e106d402ec..f1a8eedd44750 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php @@ -75,12 +75,11 @@ protected function validatePropertyValue($object, $propertyName, $value, $groups */ public function testTraversableTraverseDisabled() { - $test = $this; $entity = new Entity(); $traversable = new \ArrayIterator(array('key' => $entity)); - $callback = function () use ($test) { - $test->fail('Should not be called'); + $callback = function () { + $this->fail('Should not be called'); }; $this->metadata->addConstraint(new Callback(array( @@ -96,14 +95,13 @@ public function testTraversableTraverseDisabled() */ public function testRecursiveTraversableRecursiveTraversalDisabled() { - $test = $this; $entity = new Entity(); $traversable = new \ArrayIterator(array( 2 => new \ArrayIterator(array('key' => $entity)), )); - $callback = function () use ($test) { - $test->fail('Should not be called'); + $callback = function () { + $this->fail('Should not be called'); }; $this->metadata->addConstraint(new Callback(array( @@ -116,11 +114,10 @@ public function testRecursiveTraversableRecursiveTraversalDisabled() public function testValidateInContext() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $callback1 = function ($value, ExecutionContextInterface $context) { $previousValue = $context->getValue(); $previousMetadata = $context->getMetadata(); $previousPath = $context->getPropertyPath(); @@ -129,22 +126,22 @@ public function testValidateInContext() $context->validate($value->reference, 'subpath'); // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); + $this->assertSame($previousValue, $context->getValue()); + $this->assertSame($previousMetadata, $context->getMetadata()); + $this->assertSame($previousPath, $context->getPropertyPath()); + $this->assertSame($previousGroup, $context->getGroup()); }; - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($test->metadataFactory, $context->getMetadataFactory()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); + $callback2 = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('subpath', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($this->metadataFactory, $context->getMetadataFactory()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference, $context->getValue()); + $this->assertSame($entity->reference, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -174,11 +171,10 @@ public function testValidateInContext() public function testValidateArrayInContext() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $callback1 = function ($value, ExecutionContextInterface $context) { $previousValue = $context->getValue(); $previousMetadata = $context->getMetadata(); $previousPath = $context->getPropertyPath(); @@ -187,22 +183,22 @@ public function testValidateArrayInContext() $context->validate(array('key' => $value->reference), 'subpath'); // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); + $this->assertSame($previousValue, $context->getValue()); + $this->assertSame($previousMetadata, $context->getMetadata()); + $this->assertSame($previousPath, $context->getPropertyPath()); + $this->assertSame($previousGroup, $context->getGroup()); }; - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($test->metadataFactory, $context->getMetadataFactory()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); + $callback2 = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('subpath[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($this->metadataFactory, $context->getMetadataFactory()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference, $context->getValue()); + $this->assertSame($entity->reference, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -262,7 +258,6 @@ public function testAddCustomizedViolation() public function testInitializeObjectsOnFirstValidation() { - $test = $this; $entity = new Entity(); $entity->initialized = false; @@ -289,8 +284,8 @@ public function testInitializeObjectsOnFirstValidation() // prepare constraint which // * checks that "initialized" is set to true // * validates the object again - $callback = function ($object, ExecutionContextInterface $context) use ($test) { - $test->assertTrue($object->initialized); + $callback = function ($object, ExecutionContextInterface $context) { + $this->assertTrue($object->initialized); // validate again in same group $context->validate($object); diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php index 2236d6cb02cd3..b1f2cb0b072ca 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php @@ -71,16 +71,14 @@ abstract protected function validatePropertyValue($object, $propertyName, $value public function testValidate() { - $test = $this; - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->assertNull($context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame('Bernhard', $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); + $callback = function ($value, ExecutionContextInterface $context) { + $this->assertNull($context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame('Bernhard', $context->getRoot()); + $this->assertSame('Bernhard', $context->getValue()); + $this->assertSame('Bernhard', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -106,18 +104,17 @@ public function testValidate() public function testClassConstraint() { - $test = $this; $entity = new Entity(); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->metadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity, $context->getValue()); + $this->assertSame($entity, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -143,21 +140,20 @@ public function testClassConstraint() public function testPropertyConstraint() { - $test = $this; $entity = new Entity(); $entity->firstName = 'Bernhard'; - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $propertyMetadatas = $this->metadata->getPropertyMetadata('firstName'); - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('firstName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertSame('firstName', $context->getPropertyName()); + $this->assertSame('firstName', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame('Bernhard', $context->getValue()); + $this->assertSame('Bernhard', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -183,21 +179,20 @@ public function testPropertyConstraint() public function testGetterConstraint() { - $test = $this; $entity = new Entity(); $entity->setLastName('Schussek'); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('lastName'); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $propertyMetadatas = $this->metadata->getPropertyMetadata('lastName'); - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('lastName', $context->getPropertyName()); - $test->assertSame('lastName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Schussek', $context->getValue()); - $test->assertSame('Schussek', $value); + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertSame('lastName', $context->getPropertyName()); + $this->assertSame('lastName', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame('Schussek', $context->getValue()); + $this->assertSame('Schussek', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -223,19 +218,18 @@ public function testGetterConstraint() public function testArray() { - $test = $this; $entity = new Entity(); $array = array('key' => $entity); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($array, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity, $array) { + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->metadata, $context->getMetadata()); + $this->assertSame($array, $context->getRoot()); + $this->assertSame($entity, $context->getValue()); + $this->assertSame($entity, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -261,19 +255,18 @@ public function testArray() public function testRecursiveArray() { - $test = $this; $entity = new Entity(); $array = array(2 => array('key' => $entity)); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($array, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity, $array) { + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('[2][key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->metadata, $context->getMetadata()); + $this->assertSame($array, $context->getRoot()); + $this->assertSame($entity, $context->getValue()); + $this->assertSame($entity, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -299,19 +292,18 @@ public function testRecursiveArray() public function testTraversable() { - $test = $this; $entity = new Entity(); $traversable = new \ArrayIterator(array('key' => $entity)); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($traversable, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity, $traversable) { + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->metadata, $context->getMetadata()); + $this->assertSame($traversable, $context->getRoot()); + $this->assertSame($entity, $context->getValue()); + $this->assertSame($entity, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -337,21 +329,20 @@ public function testTraversable() public function testRecursiveTraversable() { - $test = $this; $entity = new Entity(); $traversable = new \ArrayIterator(array( 2 => new \ArrayIterator(array('key' => $entity)), )); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($traversable, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity, $traversable) { + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('[2][key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->metadata, $context->getMetadata()); + $this->assertSame($traversable, $context->getRoot()); + $this->assertSame($entity, $context->getValue()); + $this->assertSame($entity, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -377,19 +368,18 @@ public function testRecursiveTraversable() public function testReferenceClassConstraint() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('reference', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference, $context->getValue()); + $this->assertSame($entity->reference, $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -416,22 +406,21 @@ public function testReferenceClassConstraint() public function testReferencePropertyConstraint() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); $entity->reference->value = 'Foobar'; - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('value'); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $propertyMetadatas = $this->referenceMetadata->getPropertyMetadata('value'); - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertSame('value', $context->getPropertyName()); - $test->assertSame('reference.value', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Foobar', $context->getValue()); - $test->assertSame('Foobar', $value); + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertSame('value', $context->getPropertyName()); + $this->assertSame('reference.value', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame('Foobar', $context->getValue()); + $this->assertSame('Foobar', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -458,22 +447,21 @@ public function testReferencePropertyConstraint() public function testReferenceGetterConstraint() { - $test = $this; $entity = new Entity(); $entity->reference = new Reference(); $entity->reference->setPrivateValue('Bamboo'); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('privateValue'); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $propertyMetadatas = $this->referenceMetadata->getPropertyMetadata('privateValue'); - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertSame('privateValue', $context->getPropertyName()); - $test->assertSame('reference.privateValue', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bamboo', $context->getValue()); - $test->assertSame('Bamboo', $value); + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertSame('privateValue', $context->getPropertyName()); + $this->assertSame('reference.privateValue', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame('Bamboo', $context->getValue()); + $this->assertSame('Bamboo', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -526,19 +514,18 @@ public function testFailOnScalarReferences() public function testArrayReference() { - $test = $this; $entity = new Entity(); $entity->reference = array('key' => new Reference()); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference['key'], $context->getValue()); - $test->assertSame($entity->reference['key'], $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('reference[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference['key'], $context->getValue()); + $this->assertSame($entity->reference['key'], $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -566,19 +553,18 @@ public function testArrayReference() // https://github.com/symfony/symfony/issues/6246 public function testRecursiveArrayReference() { - $test = $this; $entity = new Entity(); $entity->reference = array(2 => array('key' => new Reference())); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference[2]['key'], $context->getValue()); - $test->assertSame($entity->reference[2]['key'], $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('reference[2][key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference[2]['key'], $context->getValue()); + $this->assertSame($entity->reference[2]['key'], $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -671,19 +657,18 @@ public function testIgnoreNullDuringArrayTraversal() public function testTraversableReference() { - $test = $this; $entity = new Entity(); $entity->reference = new \ArrayIterator(array('key' => new Reference())); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference['key'], $context->getValue()); - $test->assertSame($entity->reference['key'], $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('reference[key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference['key'], $context->getValue()); + $this->assertSame($entity->reference['key'], $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -746,21 +731,20 @@ public function testMetadataMustExistIfTraversalIsDisabled() public function testEnableRecursiveTraversableTraversal() { - $test = $this; $entity = new Entity(); $entity->reference = new \ArrayIterator(array( 2 => new \ArrayIterator(array('key' => new Reference())), )); - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference[2]['key'], $context->getValue()); - $test->assertSame($entity->reference[2]['key'], $value); + $callback = function ($value, ExecutionContextInterface $context) use ($entity) { + $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); + $this->assertNull($context->getPropertyName()); + $this->assertSame('reference[2][key]', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($this->referenceMetadata, $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame($entity->reference[2]['key'], $context->getValue()); + $this->assertSame($entity->reference[2]['key'], $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -789,22 +773,21 @@ public function testEnableRecursiveTraversableTraversal() public function testValidateProperty() { - $test = $this; $entity = new Entity(); $entity->firstName = 'Bernhard'; $entity->setLastName('Schussek'); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + $callback1 = function ($value, ExecutionContextInterface $context) use ($entity) { + $propertyMetadatas = $this->metadata->getPropertyMetadata('firstName'); - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('firstName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertSame('firstName', $context->getPropertyName()); + $this->assertSame('firstName', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame('Bernhard', $context->getValue()); + $this->assertSame('Bernhard', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -864,21 +847,20 @@ public function testValidatePropertyWithoutConstraints() public function testValidatePropertyValue() { - $test = $this; $entity = new Entity(); $entity->setLastName('Schussek'); - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + $callback1 = function ($value, ExecutionContextInterface $context) use ($entity) { + $propertyMetadatas = $this->metadata->getPropertyMetadata('firstName'); - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('firstName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertSame('firstName', $context->getPropertyName()); + $this->assertSame('firstName', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame($entity, $context->getRoot()); + $this->assertSame('Bernhard', $context->getValue()); + $this->assertSame('Bernhard', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; @@ -917,19 +899,17 @@ public function testValidatePropertyValue() public function testValidatePropertyValueWithClassName() { - $test = $this; - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); - - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame('Bernhard', $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); + $callback1 = function ($value, ExecutionContextInterface $context) { + $propertyMetadatas = $this->metadata->getPropertyMetadata('firstName'); + + $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); + $this->assertSame('firstName', $context->getPropertyName()); + $this->assertSame('', $context->getPropertyPath()); + $this->assertSame('Group', $context->getGroup()); + $this->assertSame($propertyMetadatas[0], $context->getMetadata()); + $this->assertSame('Bernhard', $context->getRoot()); + $this->assertSame('Bernhard', $context->getValue()); + $this->assertSame('Bernhard', $value); $context->addViolation('Message %param%', array('%param%' => 'value')); }; diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index 875c0f9cf53bc..22faadc33c337 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -142,7 +142,19 @@ public function setMaxString($maxString) */ public function cloneVar($var) { - $this->prevErrorHandler = set_error_handler(array($this, 'handleError')); + $this->prevErrorHandler = set_error_handler(function($type, $msg, $file, $line, $context) { + if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { + // Cloner never dies + throw new \ErrorException($msg, 0, $type, $file, $line); + } + + if ($this->prevErrorHandler) { + return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context); + } + + return false; + }); + try { if (!function_exists('iconv')) { $this->maxString = -1; @@ -268,23 +280,4 @@ private function callCaster($callback, $obj, $a, $stub, $isNested) return $a; } - - /** - * Special handling for errors: cloning must be fail-safe. - * - * @internal - */ - public function handleError($type, $msg, $file, $line, $context) - { - if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { - // Cloner never dies - throw new \ErrorException($msg, 0, $type, $file, $line); - } - - if ($this->prevErrorHandler) { - return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context); - } - - return false; - } } diff --git a/src/Symfony/Component/Yaml/Unescaper.php b/src/Symfony/Component/Yaml/Unescaper.php index 50b1018c404c1..71e38e155b276 100644 --- a/src/Symfony/Component/Yaml/Unescaper.php +++ b/src/Symfony/Component/Yaml/Unescaper.php @@ -49,9 +49,8 @@ public function unescapeSingleQuotedString($value) */ public function unescapeDoubleQuotedString($value) { - $self = $this; - $callback = function ($match) use ($self) { - return $self->unescapeCharacter($match[0]); + $callback = function ($match) { + return $this->unescapeCharacter($match[0]); }; // evaluate the string From 20cb7139f9228cf1ead99f43303890fd37bc18d4 Mon Sep 17 00:00:00 2001 From: Jeremy Livingston Date: Mon, 15 Dec 2014 13:23:29 -0500 Subject: [PATCH 010/240] Add LegacyPdoSessionHandler class --- UPGRADE-2.6.md | 6 +- .../Handler/LegacyPdoSessionHandler.php | 268 ++++++++++++++++++ .../Handler/LegacyPdoSessionHandlerTest.php | 111 ++++++++ 3 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php diff --git a/UPGRADE-2.6.md b/UPGRADE-2.6.md index 265f9a44f511e..01d3ac5a6c3f5 100644 --- a/UPGRADE-2.6.md +++ b/UPGRADE-2.6.md @@ -1,7 +1,7 @@ UPGRADE FROM 2.5 to 2.6 ======================= -Known Backwards-Compatability Breaks +Known Backwards-Compatibility Breaks ------------------------------------ * If you use the `PdoSessionHandler`, the session table now has a different @@ -112,7 +112,7 @@ HttpFoundation -------------- * The `PdoSessionHandler` to store sessions in a database changed significantly. - This introduced a **backwards-compatability** break in the schema of the + This introduced a **backwards-compatibility** break in the schema of the session table. The following changes must be made to your session table: - Add a new integer column called `sess_lifetime`. Assuming you have the @@ -125,6 +125,8 @@ HttpFoundation There is also an [issue](https://github.com/symfony/symfony/issues/12834) that affects Windows servers. + A legacy class, `LegacyPdoSessionHandler` has been created to ease backwards-compatibility issues when upgrading. + The changes to the `PdoSessionHandler` are: - By default, it now implements session locking to prevent loss of data by concurrent access to the same session. - It does so using a transaction between opening and closing a session. For this reason, it's not diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php new file mode 100644 index 0000000000000..fff83315aacbe --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php @@ -0,0 +1,268 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * Session handler using a PDO connection to read and write data. + * + * Session data is a binary string that can contain non-printable characters like the null byte. + * For this reason this handler base64 encodes the data to be able to save it in a character column. + * + * This version of the PdoSessionHandler does NOT implement locking. So concurrent requests to the + * same session can result in data loss due to race conditions. + * + * @author Fabien Potencier + * @author Michael Williams + * @author Tobias Schultze + * + * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use + * {@link PdoSessionHandler} instead. + */ +class LegacyPdoSessionHandler implements \SessionHandlerInterface +{ + /** + * @var \PDO PDO instance + */ + private $pdo; + + /** + * @var string Table name + */ + private $table; + + /** + * @var string Column for session id + */ + private $idCol; + + /** + * @var string Column for session data + */ + private $dataCol; + + /** + * @var string Column for timestamp + */ + private $timeCol; + + /** + * Constructor. + * + * List of available options: + * * db_table: The name of the table [required] + * * db_id_col: The column where to store the session id [default: sess_id] + * * db_data_col: The column where to store the session data [default: sess_data] + * * db_time_col: The column where to store the timestamp [default: sess_time] + * + * @param \PDO $pdo A \PDO instance + * @param array $dbOptions An associative array of DB options + * + * @throws \InvalidArgumentException When "db_table" option is not provided + */ + public function __construct(\PDO $pdo, array $dbOptions = array()) + { + if (!array_key_exists('db_table', $dbOptions)) { + throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.'); + } + if (\PDO::ERRMODE_EXCEPTION !== $pdo->getAttribute(\PDO::ATTR_ERRMODE)) { + throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); + } + $this->pdo = $pdo; + $dbOptions = array_merge(array( + 'db_id_col' => 'sess_id', + 'db_data_col' => 'sess_data', + 'db_time_col' => 'sess_time', + ), $dbOptions); + + $this->table = $dbOptions['db_table']; + $this->idCol = $dbOptions['db_id_col']; + $this->dataCol = $dbOptions['db_data_col']; + $this->timeCol = $dbOptions['db_time_col']; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + // delete the record associated with this id + $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; + + try { + $stmt = $this->pdo->prepare($sql); + $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $stmt->execute(); + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete a session: %s', $e->getMessage()), 0, $e); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($maxlifetime) + { + // delete the session records that have expired + $sql = "DELETE FROM $this->table WHERE $this->timeCol < :time"; + + try { + $stmt = $this->pdo->prepare($sql); + $stmt->bindValue(':time', time() - $maxlifetime, \PDO::PARAM_INT); + $stmt->execute(); + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete expired sessions: %s', $e->getMessage()), 0, $e); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $sql = "SELECT $this->dataCol FROM $this->table WHERE $this->idCol = :id"; + + try { + $stmt = $this->pdo->prepare($sql); + $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $stmt->execute(); + + // We use fetchAll instead of fetchColumn to make sure the DB cursor gets closed + $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM); + + if ($sessionRows) { + return base64_decode($sessionRows[0][0]); + } + + return ''; + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to read the session data: %s', $e->getMessage()), 0, $e); + } + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $encoded = base64_encode($data); + + try { + // We use a single MERGE SQL query when supported by the database. + $mergeSql = $this->getMergeSql(); + + if (null !== $mergeSql) { + $mergeStmt = $this->pdo->prepare($mergeSql); + $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $mergeStmt->execute(); + + return true; + } + + $updateStmt = $this->pdo->prepare( + "UPDATE $this->table SET $this->dataCol = :data, $this->timeCol = :time WHERE $this->idCol = :id" + ); + $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $updateStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $updateStmt->execute(); + + // When MERGE is not supported, like in Postgres, we have to use this approach that can result in + // duplicate key errors when the same session is written simultaneously. We can just catch such an + // error and re-execute the update. This is similar to a serializable transaction with retry logic + // on serialization failures but without the overhead and without possible false positives due to + // longer gap locking. + if (!$updateStmt->rowCount()) { + try { + $insertStmt = $this->pdo->prepare( + "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)" + ); + $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $insertStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $insertStmt->execute(); + } catch (\PDOException $e) { + // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys + if (0 === strpos($e->getCode(), '23')) { + $updateStmt->execute(); + } else { + throw $e; + } + } + } + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); + } + + return true; + } + + /** + * Returns a merge/upsert (i.e. insert or update) SQL query when supported by the database. + * + * @return string|null The SQL string or null when not supported + */ + private function getMergeSql() + { + $driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); + + switch ($driver) { + case 'mysql': + return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". + "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)"; + case 'oci': + // DUAL is Oracle specific dummy table + return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ". + "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". + "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time"; + case 'sqlsrv' === $driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): + // MERGE is only available since SQL Server 2008 and must be terminated by semicolon + // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx + return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ". + "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". + "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;"; + case 'sqlite': + return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"; + } + } + + /** + * Return a PDO instance + * + * @return \PDO + */ + protected function getConnection() + { + return $this->pdo; + } +} diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php new file mode 100644 index 0000000000000..5fa6255414a2d --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHandler; + +class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + private $pdo; + + protected function setUp() + { + if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { + $this->markTestSkipped('This test requires SQLite support in your environment'); + } + + $this->pdo = new \PDO('sqlite::memory:'); + $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + $sql = 'CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)'; + $this->pdo->exec($sql); + } + + public function testIncompleteOptions() + { + $this->setExpectedException('InvalidArgumentException'); + $storage = new LegacyPdoSessionHandler($this->pdo, array()); + } + + public function testWrongPdoErrMode() + { + $pdo = new \PDO('sqlite::memory:'); + $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT); + $pdo->exec('CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)'); + + $this->setExpectedException('InvalidArgumentException'); + $storage = new LegacyPdoSessionHandler($pdo, array('db_table' => 'sessions')); + } + + public function testWrongTableOptionsWrite() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); + $this->setExpectedException('RuntimeException'); + $storage->write('foo', 'bar'); + } + + public function testWrongTableOptionsRead() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); + $this->setExpectedException('RuntimeException'); + $storage->read('foo', 'bar'); + } + + public function testWriteRead() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $storage->write('foo', 'bar'); + $this->assertEquals('bar', $storage->read('foo'), 'written value can be read back correctly'); + } + + public function testMultipleInstances() + { + $storage1 = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $storage1->write('foo', 'bar'); + + $storage2 = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $this->assertEquals('bar', $storage2->read('foo'), 'values persist between instances'); + } + + public function testSessionDestroy() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $storage->write('foo', 'bar'); + $this->assertCount(1, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + + $storage->destroy('foo'); + + $this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + } + + public function testSessionGC() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + + $storage->write('foo', 'bar'); + $storage->write('baz', 'bar'); + + $this->assertCount(2, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + + $storage->gc(-1); + $this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + } + + public function testGetConnection() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + + $method = new \ReflectionMethod($storage, 'getConnection'); + $method->setAccessible(true); + + $this->assertInstanceOf('\PDO', $method->invoke($storage)); + } +} From 22b183cceb6494f214a2764d4a2134b02c4f2427 Mon Sep 17 00:00:00 2001 From: Jeremy Livingston Date: Mon, 15 Dec 2014 13:23:29 -0500 Subject: [PATCH 011/240] Add LegacyPdoSessionHandler class --- UPGRADE-2.6.md | 6 +- .../Handler/LegacyPdoSessionHandler.php | 268 ++++++++++++++++++ .../Handler/LegacyPdoSessionHandlerTest.php | 111 ++++++++ 3 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php diff --git a/UPGRADE-2.6.md b/UPGRADE-2.6.md index 265f9a44f511e..01d3ac5a6c3f5 100644 --- a/UPGRADE-2.6.md +++ b/UPGRADE-2.6.md @@ -1,7 +1,7 @@ UPGRADE FROM 2.5 to 2.6 ======================= -Known Backwards-Compatability Breaks +Known Backwards-Compatibility Breaks ------------------------------------ * If you use the `PdoSessionHandler`, the session table now has a different @@ -112,7 +112,7 @@ HttpFoundation -------------- * The `PdoSessionHandler` to store sessions in a database changed significantly. - This introduced a **backwards-compatability** break in the schema of the + This introduced a **backwards-compatibility** break in the schema of the session table. The following changes must be made to your session table: - Add a new integer column called `sess_lifetime`. Assuming you have the @@ -125,6 +125,8 @@ HttpFoundation There is also an [issue](https://github.com/symfony/symfony/issues/12834) that affects Windows servers. + A legacy class, `LegacyPdoSessionHandler` has been created to ease backwards-compatibility issues when upgrading. + The changes to the `PdoSessionHandler` are: - By default, it now implements session locking to prevent loss of data by concurrent access to the same session. - It does so using a transaction between opening and closing a session. For this reason, it's not diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php new file mode 100644 index 0000000000000..fff83315aacbe --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php @@ -0,0 +1,268 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * Session handler using a PDO connection to read and write data. + * + * Session data is a binary string that can contain non-printable characters like the null byte. + * For this reason this handler base64 encodes the data to be able to save it in a character column. + * + * This version of the PdoSessionHandler does NOT implement locking. So concurrent requests to the + * same session can result in data loss due to race conditions. + * + * @author Fabien Potencier + * @author Michael Williams + * @author Tobias Schultze + * + * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use + * {@link PdoSessionHandler} instead. + */ +class LegacyPdoSessionHandler implements \SessionHandlerInterface +{ + /** + * @var \PDO PDO instance + */ + private $pdo; + + /** + * @var string Table name + */ + private $table; + + /** + * @var string Column for session id + */ + private $idCol; + + /** + * @var string Column for session data + */ + private $dataCol; + + /** + * @var string Column for timestamp + */ + private $timeCol; + + /** + * Constructor. + * + * List of available options: + * * db_table: The name of the table [required] + * * db_id_col: The column where to store the session id [default: sess_id] + * * db_data_col: The column where to store the session data [default: sess_data] + * * db_time_col: The column where to store the timestamp [default: sess_time] + * + * @param \PDO $pdo A \PDO instance + * @param array $dbOptions An associative array of DB options + * + * @throws \InvalidArgumentException When "db_table" option is not provided + */ + public function __construct(\PDO $pdo, array $dbOptions = array()) + { + if (!array_key_exists('db_table', $dbOptions)) { + throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.'); + } + if (\PDO::ERRMODE_EXCEPTION !== $pdo->getAttribute(\PDO::ATTR_ERRMODE)) { + throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); + } + $this->pdo = $pdo; + $dbOptions = array_merge(array( + 'db_id_col' => 'sess_id', + 'db_data_col' => 'sess_data', + 'db_time_col' => 'sess_time', + ), $dbOptions); + + $this->table = $dbOptions['db_table']; + $this->idCol = $dbOptions['db_id_col']; + $this->dataCol = $dbOptions['db_data_col']; + $this->timeCol = $dbOptions['db_time_col']; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + // delete the record associated with this id + $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; + + try { + $stmt = $this->pdo->prepare($sql); + $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $stmt->execute(); + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete a session: %s', $e->getMessage()), 0, $e); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($maxlifetime) + { + // delete the session records that have expired + $sql = "DELETE FROM $this->table WHERE $this->timeCol < :time"; + + try { + $stmt = $this->pdo->prepare($sql); + $stmt->bindValue(':time', time() - $maxlifetime, \PDO::PARAM_INT); + $stmt->execute(); + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete expired sessions: %s', $e->getMessage()), 0, $e); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $sql = "SELECT $this->dataCol FROM $this->table WHERE $this->idCol = :id"; + + try { + $stmt = $this->pdo->prepare($sql); + $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $stmt->execute(); + + // We use fetchAll instead of fetchColumn to make sure the DB cursor gets closed + $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM); + + if ($sessionRows) { + return base64_decode($sessionRows[0][0]); + } + + return ''; + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to read the session data: %s', $e->getMessage()), 0, $e); + } + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $encoded = base64_encode($data); + + try { + // We use a single MERGE SQL query when supported by the database. + $mergeSql = $this->getMergeSql(); + + if (null !== $mergeSql) { + $mergeStmt = $this->pdo->prepare($mergeSql); + $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $mergeStmt->execute(); + + return true; + } + + $updateStmt = $this->pdo->prepare( + "UPDATE $this->table SET $this->dataCol = :data, $this->timeCol = :time WHERE $this->idCol = :id" + ); + $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $updateStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $updateStmt->execute(); + + // When MERGE is not supported, like in Postgres, we have to use this approach that can result in + // duplicate key errors when the same session is written simultaneously. We can just catch such an + // error and re-execute the update. This is similar to a serializable transaction with retry logic + // on serialization failures but without the overhead and without possible false positives due to + // longer gap locking. + if (!$updateStmt->rowCount()) { + try { + $insertStmt = $this->pdo->prepare( + "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)" + ); + $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $insertStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $insertStmt->execute(); + } catch (\PDOException $e) { + // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys + if (0 === strpos($e->getCode(), '23')) { + $updateStmt->execute(); + } else { + throw $e; + } + } + } + } catch (\PDOException $e) { + throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); + } + + return true; + } + + /** + * Returns a merge/upsert (i.e. insert or update) SQL query when supported by the database. + * + * @return string|null The SQL string or null when not supported + */ + private function getMergeSql() + { + $driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); + + switch ($driver) { + case 'mysql': + return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". + "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)"; + case 'oci': + // DUAL is Oracle specific dummy table + return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ". + "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". + "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time"; + case 'sqlsrv' === $driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): + // MERGE is only available since SQL Server 2008 and must be terminated by semicolon + // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx + return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ". + "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". + "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;"; + case 'sqlite': + return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"; + } + } + + /** + * Return a PDO instance + * + * @return \PDO + */ + protected function getConnection() + { + return $this->pdo; + } +} diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php new file mode 100644 index 0000000000000..5fa6255414a2d --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHandler; + +class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + private $pdo; + + protected function setUp() + { + if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { + $this->markTestSkipped('This test requires SQLite support in your environment'); + } + + $this->pdo = new \PDO('sqlite::memory:'); + $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + $sql = 'CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)'; + $this->pdo->exec($sql); + } + + public function testIncompleteOptions() + { + $this->setExpectedException('InvalidArgumentException'); + $storage = new LegacyPdoSessionHandler($this->pdo, array()); + } + + public function testWrongPdoErrMode() + { + $pdo = new \PDO('sqlite::memory:'); + $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT); + $pdo->exec('CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)'); + + $this->setExpectedException('InvalidArgumentException'); + $storage = new LegacyPdoSessionHandler($pdo, array('db_table' => 'sessions')); + } + + public function testWrongTableOptionsWrite() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); + $this->setExpectedException('RuntimeException'); + $storage->write('foo', 'bar'); + } + + public function testWrongTableOptionsRead() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); + $this->setExpectedException('RuntimeException'); + $storage->read('foo', 'bar'); + } + + public function testWriteRead() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $storage->write('foo', 'bar'); + $this->assertEquals('bar', $storage->read('foo'), 'written value can be read back correctly'); + } + + public function testMultipleInstances() + { + $storage1 = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $storage1->write('foo', 'bar'); + + $storage2 = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $this->assertEquals('bar', $storage2->read('foo'), 'values persist between instances'); + } + + public function testSessionDestroy() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + $storage->write('foo', 'bar'); + $this->assertCount(1, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + + $storage->destroy('foo'); + + $this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + } + + public function testSessionGC() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions')); + + $storage->write('foo', 'bar'); + $storage->write('baz', 'bar'); + + $this->assertCount(2, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + + $storage->gc(-1); + $this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); + } + + public function testGetConnection() + { + $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + + $method = new \ReflectionMethod($storage, 'getConnection'); + $method->setAccessible(true); + + $this->assertInstanceOf('\PDO', $method->invoke($storage)); + } +} From dfb97068ee46ae87ec80c49ae20c6ccc07b30558 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Fri, 26 Dec 2014 01:27:55 +0100 Subject: [PATCH 012/240] [Console] Removed DialogHelper, ProgressHelper and TableHelper --- .../Console/Descriptor/Descriptor.php | 19 +- .../Console/Descriptor/TextDescriptor.php | 29 +- .../Descriptor/AbstractDescriptorTest.php | 2 +- .../Tests/Fixtures/Descriptor/alias_1.md | 2 +- .../Tests/Fixtures/Descriptor/alias_2.md | 2 +- .../Fixtures/Descriptor/builder_1_public.md | 2 +- .../Fixtures/Descriptor/builder_1_public.txt | 13 +- .../Fixtures/Descriptor/builder_1_services.md | 2 +- .../Descriptor/builder_1_services.txt | 16 +- .../Fixtures/Descriptor/builder_1_tag1.txt | 9 +- .../Tests/Fixtures/Descriptor/callable_1.md | 1 + .../Tests/Fixtures/Descriptor/callable_1.txt | 2 +- .../Tests/Fixtures/Descriptor/callable_2.md | 1 + .../Tests/Fixtures/Descriptor/callable_2.txt | 2 +- .../Tests/Fixtures/Descriptor/callable_3.md | 1 + .../Tests/Fixtures/Descriptor/callable_3.txt | 2 +- .../Tests/Fixtures/Descriptor/callable_4.md | 1 + .../Tests/Fixtures/Descriptor/callable_4.txt | 2 +- .../Tests/Fixtures/Descriptor/callable_5.md | 1 + .../Tests/Fixtures/Descriptor/callable_5.txt | 2 +- .../Tests/Fixtures/Descriptor/callable_6.md | 1 + .../Tests/Fixtures/Descriptor/callable_6.txt | 2 +- .../Tests/Fixtures/Descriptor/callable_7.md | 2 +- .../Tests/Fixtures/Descriptor/callable_7.txt | 2 +- .../Tests/Fixtures/Descriptor/definition_1.md | 2 +- .../Tests/Fixtures/Descriptor/definition_2.md | 2 +- .../Descriptor/event_dispatcher_1_event1.txt | 2 +- .../Descriptor/event_dispatcher_1_events.txt | 10 +- .../Tests/Fixtures/Descriptor/parameter.md | 2 +- .../Tests/Fixtures/Descriptor/parameter.txt | 2 +- .../Tests/Fixtures/Descriptor/parameters_1.md | 2 +- .../Fixtures/Descriptor/parameters_1.txt | 14 +- .../Tests/Fixtures/Descriptor/route_1.md | 2 +- .../Tests/Fixtures/Descriptor/route_1.txt | 2 +- .../Tests/Fixtures/Descriptor/route_2.md | 2 +- .../Tests/Fixtures/Descriptor/route_2.txt | 2 +- .../Fixtures/Descriptor/route_collection_1.md | 1 + .../Descriptor/route_collection_1.txt | 10 +- src/Symfony/Component/Console/Application.php | 6 - .../Console/Descriptor/Descriptor.php | 2 +- .../Component/Console/Helper/DialogHelper.php | 479 ------------------ .../Component/Console/Helper/HelperSet.php | 8 - .../Console/Helper/ProgressHelper.php | 464 ----------------- .../Component/Console/Helper/TableHelper.php | 267 ---------- .../Console/Tests/ApplicationTest.php | 2 - .../Console/Tests/Helper/DialogHelperTest.php | 192 ------- .../Tests/Helper/ProgressHelperTest.php | 224 -------- .../Console/Tests/Helper/TableHelperTest.php | 294 ----------- 48 files changed, 85 insertions(+), 2026 deletions(-) delete mode 100644 src/Symfony/Component/Console/Helper/DialogHelper.php delete mode 100644 src/Symfony/Component/Console/Helper/ProgressHelper.php delete mode 100644 src/Symfony/Component/Console/Helper/TableHelper.php delete mode 100644 src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.php delete mode 100644 src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php delete mode 100644 src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 7a345938bd02d..df8f1162dee54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -12,7 +12,6 @@ namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; use Symfony\Component\Console\Descriptor\DescriptorInterface; -use Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -30,7 +29,7 @@ abstract class Descriptor implements DescriptorInterface /** * @var OutputInterface */ - private $output; + protected $output; /** * {@inheritdoc} @@ -89,22 +88,6 @@ protected function write($content, $decorated = false) $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); } - /** - * Writes content to output. - * - * @param TableHelper $table - * @param bool $decorated - */ - protected function renderTable(TableHelper $table, $decorated = false) - { - if (!$decorated) { - $table->setCellRowFormat('%s'); - $table->setCellHeaderFormat('%s'); - } - - $table->render($this->output); - } - /** * Describes an InputArgument instance. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 4a391b4333477..88ad0ea3bc96f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; -use Symfony\Component\Console\Helper\TableHelper; +use Symfony\Component\Console\Helper\Table; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -30,10 +30,10 @@ class TextDescriptor extends Descriptor */ protected function describeRouteCollection(RouteCollection $routes, array $options = array()) { + $table = new Table($this->output); + $showControllers = isset($options['show_controllers']) && $options['show_controllers']; $headers = array('Name', 'Method', 'Scheme', 'Host', 'Path'); - $table = new TableHelper(); - $table->setLayout(TableHelper::LAYOUT_COMPACT); $table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers); foreach ($routes->all() as $name => $route) { @@ -59,7 +59,7 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio } $this->writeText($this->formatSection('router', 'Current routes')."\n", $options); - $this->renderTable($table, !(isset($options['raw_output']) && $options['raw_output'])); + $table->render(); } /** @@ -100,8 +100,7 @@ protected function describeRoute(Route $route, array $options = array()) */ protected function describeContainerParameters(ParameterBag $parameters, array $options = array()) { - $table = new TableHelper(); - $table->setLayout(TableHelper::LAYOUT_COMPACT); + $table = new Table($this->output); $table->setHeaders(array('Parameter', 'Value')); foreach ($this->sortParameters($parameters) as $parameter => $value) { @@ -109,7 +108,7 @@ protected function describeContainerParameters(ParameterBag $parameters, array $ } $this->writeText($this->formatSection('container', 'List of parameters')."\n", $options); - $this->renderTable($table, !(isset($options['raw_output']) && $options['raw_output'])); + $table->render(); } /** @@ -201,8 +200,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o $tagsCount = count($maxTags); $tagsNames = array_keys($maxTags); - $table = new TableHelper(); - $table->setLayout(TableHelper::LAYOUT_COMPACT); + $table = new Table($this->output); $table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Class name'))); foreach ($this->sortServiceIds($serviceIds) as $serviceId) { @@ -232,7 +230,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o } } - $this->renderTable($table); + $table->render(); } /** @@ -302,31 +300,30 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev $this->writeText($this->formatSection('event_dispatcher', $label)."\n", $options); $registeredListeners = $eventDispatcher->getListeners($event); + $table = new Table($this->output); + if (null !== $event) { $this->writeText("\n"); - $table = new TableHelper(); + $table->setHeaders(array('Order', 'Callable')); foreach ($registeredListeners as $order => $listener) { $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener))); } - - $this->renderTable($table); } else { ksort($registeredListeners); foreach ($registeredListeners as $eventListened => $eventListeners) { $this->writeText(sprintf("\n[Event] %s\n", $eventListened), $options); - $table = new TableHelper(); $table->setHeaders(array('Order', 'Callable')); foreach ($eventListeners as $order => $eventListener) { $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener))); } - - $this->renderTable($table); } } + + $table->render(); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php index 481744aac0a91..b0edee046b727 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -137,7 +137,7 @@ private function assertDescription($expectedDescription, $describedObject, array if ('json' === $this->getFormat()) { $this->assertEquals(json_decode($expectedDescription), json_decode($output->fetch())); } else { - $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch()))); + $this->assertEquals($expectedDescription, $output->fetch()); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.md index ec63107b93b0f..3220d5f1393f0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_1.md @@ -1,2 +1,2 @@ - Service: `service_1` -- Public: yes +- Public: yes \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md index f2a46087c162e..73a4101d8bce3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md @@ -1,2 +1,2 @@ - Service: `service_2` -- Public: no +- Public: no \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md index 196757b13b7a2..044eade656f9d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md @@ -32,4 +32,4 @@ alias_2 Services -------- -- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder` +- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt index b6debca225fea..a8243a4009f24 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt @@ -1,6 +1,9 @@ [container] Public services - Service ID Class name - alias_1 alias for "service_1" - alias_2 alias for "service_2" - definition_1 Full\Qualified\Class1 - service_container Symfony\Component\DependencyInjection\ContainerBuilder ++-------------------+--------------------------------------------------------+ +| Service ID | Class name | ++-------------------+--------------------------------------------------------+ +| alias_1 | alias for "service_1" | +| alias_2 | alias for "service_2" | +| definition_1 | Full\Qualified\Class1 | +| service_container | Symfony\Component\DependencyInjection\ContainerBuilder | ++-------------------+--------------------------------------------------------+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md index 33cb0a93a74c9..b4d2025acd17a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md @@ -47,4 +47,4 @@ alias_2 Services -------- -- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder` +- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt index e203d5a90fad7..58307ff202119 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt @@ -1,8 +1,10 @@ [container] Public and private services - Service ID Class name - alias_1 alias for "service_1" - alias_2 alias for "service_2" - definition_1 Full\Qualified\Class1 - definition_2 Full\Qualified\Class2 - service_container Symfony\Component\DependencyInjection\ContainerBuilder - ++-------------------+--------------------------------------------------------+ +| Service ID | Class name | ++-------------------+--------------------------------------------------------+ +| alias_1 | alias for "service_1" | +| alias_2 | alias for "service_2" | +| definition_1 | Full\Qualified\Class1 | +| definition_2 | Full\Qualified\Class2 | +| service_container | Symfony\Component\DependencyInjection\ContainerBuilder | ++-------------------+--------------------------------------------------------+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt index da12899f94083..b84e5450e0d0e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt @@ -1,4 +1,7 @@ [container] Public and private services with tag tag1 - Service ID attr1 attr2 attr3 Class name - definition_2 val1 val2 Full\Qualified\Class2 - " val3 ++--------------+-------+-------+-------+-----------------------+ +| Service ID | attr1 | attr2 | attr3 | Class name | ++--------------+-------+-------+-------+-----------------------+ +| definition_2 | val1 | val2 | | Full\Qualified\Class2 | +| " | | | val3 | | ++--------------+-------+-------+-------+-----------------------+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.md index 0c3e1dd6f26dd..9cf31352e3cfd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.md @@ -1,2 +1,3 @@ + - Type: `function` - Name: `array_key_exists` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.txt index 92ac06e2f64d5..09901c3c403c1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_1.txt @@ -1 +1 @@ -array_key_exists() +array_key_exists() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.md index cef6d81ed1fd6..c041ee8ea6fc4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.md @@ -1,3 +1,4 @@ + - Type: `function` - Name: `staticMethod` - Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.txt index e58a2ba59a515..5e3101e1bc2c2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_2.txt @@ -1 +1 @@ -Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod() +Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.md index 8b260e7074410..3b61c0da2ee77 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.md @@ -1,3 +1,4 @@ + - Type: `function` - Name: `method` - Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.txt index e2f79511ee2c9..dde0dbba2e3d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_3.txt @@ -1 +1 @@ -Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::method() +Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::method() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.md index cef6d81ed1fd6..c041ee8ea6fc4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.md @@ -1,3 +1,4 @@ + - Type: `function` - Name: `staticMethod` - Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.txt index e58a2ba59a515..5e3101e1bc2c2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_4.txt @@ -1 +1 @@ -Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod() +Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.md index 9fd61c39ac2e2..fc69e9bafc01f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.md @@ -1,3 +1,4 @@ + - Type: `function` - Name: `staticMethod` - Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.txt index 1c48ebc471cc6..1c06a7e9a5cfd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_5.txt @@ -1 +1 @@ -Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass::parent::staticMethod() +Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass::parent::staticMethod() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.md index 0fb5bdb107b37..474a9ddc24cc2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.md @@ -1 +1,2 @@ + - Type: `closure` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.txt index 56996feb78930..9b030ab7913a9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_6.txt @@ -1 +1 @@ -\Closure() +\Closure() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.md index b6a236ce7bac6..c9ad7af95d8c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.md @@ -1,3 +1,3 @@ + - Type: `object` - Name: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass` - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.txt index 66274dc2cd4d7..78ef6a6527cae 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/callable_7.txt @@ -1 +1 @@ -Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() +Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md index 49005b12a4a47..3f85a7c305daa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md @@ -1,4 +1,4 @@ - Class: `Full\Qualified\Class1` - Scope: `container` - Public: yes -- Synthetic: no +- Synthetic: no \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md index 521b496e07609..dad1c7f470c57 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.md @@ -8,4 +8,4 @@ - Attr2: val2 - Tag: `tag1` - Attr3: val3 -- Tag: `tag2` +- Tag: `tag2` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_event1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_event1.txt index 22b17a19cfb91..9cd9ca96592cb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_event1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_event1.txt @@ -1,7 +1,7 @@ [event_dispatcher] Registered listeners for event event1 +-------+-------------------+ -| Order | Callable | +| Order | Callable | +-------+-------------------+ | #1 | global_function() | | #2 | \Closure() | diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt index 95a5b4648e939..4cd880b0ef9f4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt @@ -1,16 +1,12 @@ [event_dispatcher] Registered listeners by event [Event] event1 -+-------+-------------------+ -| Order | Callable | -+-------+-------------------+ -| #1 | global_function() | -| #2 | \Closure() | -+-------+-------------------+ [Event] event2 +-------+-----------------------------------------------------------------------------------+ -| Order | Callable | +| Order | Callable | +-------+-----------------------------------------------------------------------------------+ +| #1 | global_function() | +| #2 | \Closure() | | #1 | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() | +-------+-----------------------------------------------------------------------------------+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.md index 4c67978f68347..239e98d6aac72 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.md @@ -1,4 +1,4 @@ database_name ============= -symfony +symfony \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.txt index a1435083911ce..6bc5995f62e34 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameter.txt @@ -1 +1 @@ -symfony +symfony \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.md index 2dfe5d640b858..c1eb4dc90fc4f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.md @@ -4,4 +4,4 @@ Container parameters - `array`: `[12,"Hello world!",true]` - `boolean`: `true` - `integer`: `12` -- `string`: `Hello world!` +- `string`: `Hello world!` \ No newline at end of file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.txt index 1c9a2739ca63c..0d418dd07b68a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/parameters_1.txt @@ -1,7 +1,9 @@ [container] List of parameters - Parameter Value - array [12,"Hello world!",true] - boolean true - integer 12 - string Hello world! - \ No newline at end of file ++-----------+--------------------------+ +| Parameter | Value | ++-----------+--------------------------+ +| array | [12,"Hello world!",true] | +| boolean | true | +| integer | 12 | +| string | Hello world! | ++-----------+--------------------------+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md index 4ac00a8929755..269bd11a6612f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md @@ -6,4 +6,4 @@ - Defaults: - `name`: Joseph - Requirements: - - `name`: [a-z]+ \ No newline at end of file + - `name`: [a-z]+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt index 2552c1ed88993..54bf11b4eb239 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt @@ -9,4 +9,4 @@ opt1: val1 opt2: val2 Path-Regex #^/hello(?:/(?P[a-z]+))?$#s -Host-Regex #^localhost$#s \ No newline at end of file +Host-Regex #^localhost$#s diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md index c19d75f4f3b13..494f3223a28b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md @@ -4,4 +4,4 @@ - Method: PUT|POST - Class: Symfony\Component\Routing\Route - Defaults: NONE -- Requirements: NONE \ No newline at end of file +- Requirements: NONE diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt index 99119b6cc4e90..70eca6c7e4885 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt @@ -9,4 +9,4 @@ opt1: val1 opt2: val2 Path-Regex #^/name/add$#s -Host-Regex #^localhost$#s \ No newline at end of file +Host-Regex #^localhost$#s diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md index a148c23210bad..981adc208c7bc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md @@ -22,3 +22,4 @@ route_2 - Class: Symfony\Component\Routing\Route - Defaults: NONE - Requirements: NONE + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.txt index e0ade43e2afd3..ce7f760d02fd6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.txt @@ -1,5 +1,7 @@ [router] Current routes - Name Method Scheme Host Path - route_1 GET|HEAD http|https localhost /hello/{name} - route_2 PUT|POST http|https localhost /name/add - \ No newline at end of file ++---------+----------+------------+-----------+---------------+ +| Name | Method | Scheme | Host | Path | ++---------+----------+------------+-----------+---------------+ +| route_1 | GET|HEAD | http|https | localhost | /hello/{name} | +| route_2 | PUT|POST | http|https | localhost | /name/add | ++---------+----------+------------+-----------+---------------+ diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 3f1b6604c9647..8249fad47daa0 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -32,9 +32,6 @@ use Symfony\Component\Console\Command\ListCommand; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; -use Symfony\Component\Console\Helper\DialogHelper; -use Symfony\Component\Console\Helper\ProgressHelper; -use Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\Console\Event\ConsoleExceptionEvent; use Symfony\Component\Console\Event\ConsoleTerminateEvent; @@ -950,9 +947,6 @@ protected function getDefaultHelperSet() { return new HelperSet(array( new FormatterHelper(), - new DialogHelper(false), - new ProgressHelper(false), - new TableHelper(false), new DebugFormatterHelper(), new ProcessHelper(), new QuestionHelper(), diff --git a/src/Symfony/Component/Console/Descriptor/Descriptor.php b/src/Symfony/Component/Console/Descriptor/Descriptor.php index 952341579a847..7536838f71880 100644 --- a/src/Symfony/Component/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Component/Console/Descriptor/Descriptor.php @@ -26,7 +26,7 @@ abstract class Descriptor implements DescriptorInterface /** * @var OutputInterface */ - private $output; + protected $output; /** * {@inheritdoc} diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php deleted file mode 100644 index 4d6eccd95fde6..0000000000000 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ /dev/null @@ -1,479 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; - -/** - * The Dialog class provides helpers to interact with the user. - * - * @author Fabien Potencier - * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * Use {@link \Symfony\Component\Console\Helper\QuestionHelper} instead. - */ -class DialogHelper extends InputAwareHelper -{ - private $inputStream; - private static $shell; - private static $stty; - - public function __construct($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED); - } - } - - /** - * Asks the user to select a value. - * - * @param OutputInterface $output An Output instance - * @param string|array $question The question to ask - * @param array $choices List of choices to pick from - * @param bool|string $default The default answer if the user enters nothing - * @param bool|int $attempts Max number of times to ask before giving up (false by default, which means infinite) - * @param string $errorMessage Message which will be shown if invalid value from choice list would be picked - * @param bool $multiselect Select more than one value separated by comma - * - * @return int|string|array The selected value or values (the key of the choices array) - * - * @throws \InvalidArgumentException - */ - public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false) - { - $width = max(array_map('strlen', array_keys($choices))); - - $messages = (array) $question; - foreach ($choices as $key => $value) { - $messages[] = sprintf(" [%-${width}s] %s", $key, $value); - } - - $output->writeln($messages); - - $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) { - // Collapse all spaces. - $selectedChoices = str_replace(" ", "", $picked); - - if ($multiselect) { - // Check for a separated comma values - if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) { - throw new \InvalidArgumentException(sprintf($errorMessage, $picked)); - } - $selectedChoices = explode(",", $selectedChoices); - } else { - $selectedChoices = array($picked); - } - - $multiselectChoices = array(); - - foreach ($selectedChoices as $value) { - if (empty($choices[$value])) { - throw new \InvalidArgumentException(sprintf($errorMessage, $value)); - } - array_push($multiselectChoices, $value); - } - - if ($multiselect) { - return $multiselectChoices; - } - - return $picked; - }, $attempts, $default); - - return $result; - } - - /** - * Asks a question to the user. - * - * @param OutputInterface $output An Output instance - * @param string|array $question The question to ask - * @param string $default The default answer if none is given by the user - * @param array $autocomplete List of values to autocomplete - * - * @return string The user answer - * - * @throws \RuntimeException If there is no data to read in the input stream - */ - public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null) - { - if ($this->input && !$this->input->isInteractive()) { - return $default; - } - - $output->write($question); - - $inputStream = $this->inputStream ?: STDIN; - - if (null === $autocomplete || !$this->hasSttyAvailable()) { - $ret = fgets($inputStream, 4096); - if (false === $ret) { - throw new \RuntimeException('Aborted'); - } - $ret = trim($ret); - } else { - $ret = ''; - - $i = 0; - $ofs = -1; - $matches = $autocomplete; - $numMatches = count($matches); - - $sttyMode = shell_exec('stty -g'); - - // Disable icanon (so we can fread each keypress) and echo (we'll do echoing here instead) - shell_exec('stty -icanon -echo'); - - // Add highlighted text style - $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white')); - - // Read a keypress - while (!feof($inputStream)) { - $c = fread($inputStream, 1); - - // Backspace Character - if ("\177" === $c) { - if (0 === $numMatches && 0 !== $i) { - $i--; - // Move cursor backwards - $output->write("\033[1D"); - } - - if ($i === 0) { - $ofs = -1; - $matches = $autocomplete; - $numMatches = count($matches); - } else { - $numMatches = 0; - } - - // Pop the last character off the end of our string - $ret = substr($ret, 0, $i); - } elseif ("\033" === $c) { - // Did we read an escape sequence? - $c .= fread($inputStream, 2); - - // A = Up Arrow. B = Down Arrow - if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) { - if ('A' === $c[2] && -1 === $ofs) { - $ofs = 0; - } - - if (0 === $numMatches) { - continue; - } - - $ofs += ('A' === $c[2]) ? -1 : 1; - $ofs = ($numMatches + $ofs) % $numMatches; - } - } elseif (ord($c) < 32) { - if ("\t" === $c || "\n" === $c) { - if ($numMatches > 0 && -1 !== $ofs) { - $ret = $matches[$ofs]; - // Echo out remaining chars for current match - $output->write(substr($ret, $i)); - $i = strlen($ret); - } - - if ("\n" === $c) { - $output->write($c); - break; - } - - $numMatches = 0; - } - - continue; - } else { - $output->write($c); - $ret .= $c; - $i++; - - $numMatches = 0; - $ofs = 0; - - foreach ($autocomplete as $value) { - // If typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle) - if (0 === strpos($value, $ret) && $i !== strlen($value)) { - $matches[$numMatches++] = $value; - } - } - } - - // Erase characters from cursor to end of line - $output->write("\033[K"); - - if ($numMatches > 0 && -1 !== $ofs) { - // Save cursor position - $output->write("\0337"); - // Write highlighted text - $output->write(''.substr($matches[$ofs], $i).''); - // Restore cursor position - $output->write("\0338"); - } - } - - // Reset stty so it behaves normally again - shell_exec(sprintf('stty %s', $sttyMode)); - } - - return strlen($ret) > 0 ? $ret : $default; - } - - /** - * Asks a confirmation to the user. - * - * The question will be asked until the user answers by nothing, yes, or no. - * - * @param OutputInterface $output An Output instance - * @param string|array $question The question to ask - * @param bool $default The default answer if the user enters nothing - * - * @return bool true if the user has confirmed, false otherwise - */ - public function askConfirmation(OutputInterface $output, $question, $default = true) - { - $answer = 'z'; - while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) { - $answer = $this->ask($output, $question); - } - - if (false === $default) { - return $answer && 'y' == strtolower($answer[0]); - } - - return !$answer || 'y' == strtolower($answer[0]); - } - - /** - * Asks a question to the user, the response is hidden. - * - * @param OutputInterface $output An Output instance - * @param string|array $question The question - * @param bool $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not - * - * @return string The answer - * - * @throws \RuntimeException In case the fallback is deactivated and the response can not be hidden - */ - public function askHiddenResponse(OutputInterface $output, $question, $fallback = true) - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; - - // handle code running from a phar - if ('phar:' === substr(__FILE__, 0, 5)) { - $tmpExe = sys_get_temp_dir().'/hiddeninput.exe'; - copy($exe, $tmpExe); - $exe = $tmpExe; - } - - $output->write($question); - $value = rtrim(shell_exec($exe)); - $output->writeln(''); - - if (isset($tmpExe)) { - unlink($tmpExe); - } - - return $value; - } - - if ($this->hasSttyAvailable()) { - $output->write($question); - - $sttyMode = shell_exec('stty -g'); - - shell_exec('stty -echo'); - $value = fgets($this->inputStream ?: STDIN, 4096); - shell_exec(sprintf('stty %s', $sttyMode)); - - if (false === $value) { - throw new \RuntimeException('Aborted'); - } - - $value = trim($value); - $output->writeln(''); - - return $value; - } - - if (false !== $shell = $this->getShell()) { - $output->write($question); - $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword'; - $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd); - $value = rtrim(shell_exec($command)); - $output->writeln(''); - - return $value; - } - - if ($fallback) { - return $this->ask($output, $question); - } - - throw new \RuntimeException('Unable to hide the response'); - } - - /** - * Asks for a value and validates the response. - * - * The validator receives the data to validate. It must return the - * validated data when the data is valid and throw an exception - * otherwise. - * - * @param OutputInterface $output An Output instance - * @param string|array $question The question to ask - * @param callable $validator A PHP callback - * @param int|false $attempts Max number of times to ask before giving up (false by default, which means infinite) - * @param string $default The default answer if none is given by the user - * @param array $autocomplete List of values to autocomplete - * - * @return mixed - * - * @throws \Exception When any of the validators return an error - */ - public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null) - { - $interviewer = function () use ($output, $question, $default, $autocomplete) { - return $this->ask($output, $question, $default, $autocomplete); - }; - - return $this->validateAttempts($interviewer, $output, $validator, $attempts); - } - - /** - * Asks for a value, hide and validates the response. - * - * The validator receives the data to validate. It must return the - * validated data when the data is valid and throw an exception - * otherwise. - * - * @param OutputInterface $output An Output instance - * @param string|array $question The question to ask - * @param callable $validator A PHP callback - * @param int|false $attempts Max number of times to ask before giving up (false by default, which means infinite) - * @param bool $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not - * - * @return string The response - * - * @throws \Exception When any of the validators return an error - * @throws \RuntimeException In case the fallback is deactivated and the response can not be hidden - */ - public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true) - { - $interviewer = function () use ($output, $question, $fallback) { - return $this->askHiddenResponse($output, $question, $fallback); - }; - - return $this->validateAttempts($interviewer, $output, $validator, $attempts); - } - - /** - * Sets the input stream to read from when interacting with the user. - * - * This is mainly useful for testing purpose. - * - * @param resource $stream The input stream - */ - public function setInputStream($stream) - { - $this->inputStream = $stream; - } - - /** - * Returns the helper's input stream. - * - * @return string - */ - public function getInputStream() - { - return $this->inputStream; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'dialog'; - } - - /** - * Return a valid Unix shell. - * - * @return string|bool The valid shell name, false in case no valid shell is found - */ - private function getShell() - { - if (null !== self::$shell) { - return self::$shell; - } - - self::$shell = false; - - if (file_exists('/usr/bin/env')) { - // handle other OSs with bash/zsh/ksh/csh if available to hide the answer - $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; - foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) { - if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) { - self::$shell = $sh; - break; - } - } - } - - return self::$shell; - } - - private function hasSttyAvailable() - { - if (null !== self::$stty) { - return self::$stty; - } - - exec('stty 2>&1', $output, $exitcode); - - return self::$stty = $exitcode === 0; - } - - /** - * Validate an attempt. - * - * @param callable $interviewer A callable that will ask for a question and return the result - * @param OutputInterface $output An Output instance - * @param callable $validator A PHP callback - * @param int|false $attempts Max number of times to ask before giving up ; false will ask infinitely - * - * @return string The validated response - * - * @throws \Exception In case the max number of attempts has been reached and no valid response has been given - */ - private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts) - { - $error = null; - while (false === $attempts || $attempts--) { - if (null !== $error) { - $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error')); - } - - try { - return call_user_func($validator, $interviewer()); - } catch (\Exception $error) { - } - } - - throw $error; - } -} diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index 52a669d48542b..467be86a85d75 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -78,14 +78,6 @@ public function get($name) throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); } - if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) { - trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED); - } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) { - trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED); - } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) { - trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED); - } - return $this->helpers[$name]; } diff --git a/src/Symfony/Component/Console/Helper/ProgressHelper.php b/src/Symfony/Component/Console/Helper/ProgressHelper.php deleted file mode 100644 index d1ab241ac0027..0000000000000 --- a/src/Symfony/Component/Console/Helper/ProgressHelper.php +++ /dev/null @@ -1,464 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Output\NullOutput; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * The Progress class provides helpers to display progress output. - * - * @author Chris Jones - * @author Fabien Potencier - * - * @deprecated Deprecated since 2.5, to be removed in 3.0; use ProgressBar instead. - */ -class ProgressHelper extends Helper -{ - const FORMAT_QUIET = ' %percent%%'; - const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%'; - const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%'; - const FORMAT_QUIET_NOMAX = ' %current%'; - const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]'; - const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%'; - - // options - private $barWidth = 28; - private $barChar = '='; - private $emptyBarChar = '-'; - private $progressChar = '>'; - private $format = null; - private $redrawFreq = 1; - - private $lastMessagesLength; - private $barCharOriginal; - - /** - * @var OutputInterface - */ - private $output; - - /** - * Current step. - * - * @var int - */ - private $current; - - /** - * Maximum number of steps. - * - * @var int - */ - private $max; - - /** - * Start time of the progress bar. - * - * @var int - */ - private $startTime; - - /** - * List of formatting variables. - * - * @var array - */ - private $defaultFormatVars = array( - 'current', - 'max', - 'bar', - 'percent', - 'elapsed', - ); - - /** - * Available formatting variables. - * - * @var array - */ - private $formatVars; - - /** - * Stored format part widths (used for padding). - * - * @var array - */ - private $widths = array( - 'current' => 4, - 'max' => 4, - 'percent' => 3, - 'elapsed' => 6, - ); - - /** - * Various time formats. - * - * @var array - */ - private $timeFormats = array( - array(0, '???'), - array(2, '1 sec'), - array(59, 'secs', 1), - array(60, '1 min'), - array(3600, 'mins', 60), - array(5400, '1 hr'), - array(86400, 'hrs', 3600), - array(129600, '1 day'), - array(604800, 'days', 86400), - ); - - public function __construct($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED); - } - } - - /** - * Sets the progress bar width. - * - * @param int $size The progress bar size - */ - public function setBarWidth($size) - { - $this->barWidth = (int) $size; - } - - /** - * Sets the bar character. - * - * @param string $char A character - */ - public function setBarCharacter($char) - { - $this->barChar = $char; - } - - /** - * Sets the empty bar character. - * - * @param string $char A character - */ - public function setEmptyBarCharacter($char) - { - $this->emptyBarChar = $char; - } - - /** - * Sets the progress bar character. - * - * @param string $char A character - */ - public function setProgressCharacter($char) - { - $this->progressChar = $char; - } - - /** - * Sets the progress bar format. - * - * @param string $format The format - */ - public function setFormat($format) - { - $this->format = $format; - } - - /** - * Sets the redraw frequency. - * - * @param int $freq The frequency in steps - */ - public function setRedrawFrequency($freq) - { - $this->redrawFreq = (int) $freq; - } - - /** - * Starts the progress output. - * - * @param OutputInterface $output An Output instance - * @param int|null $max Maximum steps - */ - public function start(OutputInterface $output, $max = null) - { - $this->startTime = time(); - $this->current = 0; - $this->max = (int) $max; - - // Disabling output when it does not support ANSI codes as it would result in a broken display anyway. - $this->output = $output->isDecorated() ? $output : new NullOutput(); - $this->lastMessagesLength = 0; - $this->barCharOriginal = ''; - - if (null === $this->format) { - switch ($output->getVerbosity()) { - case OutputInterface::VERBOSITY_QUIET: - $this->format = self::FORMAT_QUIET_NOMAX; - if ($this->max > 0) { - $this->format = self::FORMAT_QUIET; - } - break; - case OutputInterface::VERBOSITY_VERBOSE: - case OutputInterface::VERBOSITY_VERY_VERBOSE: - case OutputInterface::VERBOSITY_DEBUG: - $this->format = self::FORMAT_VERBOSE_NOMAX; - if ($this->max > 0) { - $this->format = self::FORMAT_VERBOSE; - } - break; - default: - $this->format = self::FORMAT_NORMAL_NOMAX; - if ($this->max > 0) { - $this->format = self::FORMAT_NORMAL; - } - break; - } - } - - $this->initialize(); - } - - /** - * Advances the progress output X steps. - * - * @param int $step Number of steps to advance - * @param bool $redraw Whether to redraw or not - * - * @throws \LogicException - */ - public function advance($step = 1, $redraw = false) - { - $this->setCurrent($this->current + $step, $redraw); - } - - /** - * Sets the current progress. - * - * @param int $current The current progress - * @param bool $redraw Whether to redraw or not - * - * @throws \LogicException - */ - public function setCurrent($current, $redraw = false) - { - if (null === $this->startTime) { - throw new \LogicException('You must start the progress bar before calling setCurrent().'); - } - - $current = (int) $current; - - if ($current < $this->current) { - throw new \LogicException('You can\'t regress the progress bar'); - } - - if (0 === $this->current) { - $redraw = true; - } - - $prevPeriod = intval($this->current / $this->redrawFreq); - - $this->current = $current; - - $currPeriod = intval($this->current / $this->redrawFreq); - if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) { - $this->display(); - } - } - - /** - * Outputs the current progress string. - * - * @param bool $finish Forces the end result - * - * @throws \LogicException - */ - public function display($finish = false) - { - if (null === $this->startTime) { - throw new \LogicException('You must start the progress bar before calling display().'); - } - - $message = $this->format; - foreach ($this->generate($finish) as $name => $value) { - $message = str_replace("%{$name}%", $value, $message); - } - $this->overwrite($this->output, $message); - } - - /** - * Removes the progress bar from the current line. - * - * This is useful if you wish to write some output - * while a progress bar is running. - * Call display() to show the progress bar again. - */ - public function clear() - { - $this->overwrite($this->output, ''); - } - - /** - * Finishes the progress output. - */ - public function finish() - { - if (null === $this->startTime) { - throw new \LogicException('You must start the progress bar before calling finish().'); - } - - if (null !== $this->startTime) { - if (!$this->max) { - $this->barChar = $this->barCharOriginal; - $this->display(true); - } - $this->startTime = null; - $this->output->writeln(''); - $this->output = null; - } - } - - /** - * Initializes the progress helper. - */ - private function initialize() - { - $this->formatVars = array(); - foreach ($this->defaultFormatVars as $var) { - if (false !== strpos($this->format, "%{$var}%")) { - $this->formatVars[$var] = true; - } - } - - if ($this->max > 0) { - $this->widths['max'] = $this->strlen($this->max); - $this->widths['current'] = $this->widths['max']; - } else { - $this->barCharOriginal = $this->barChar; - $this->barChar = $this->emptyBarChar; - } - } - - /** - * Generates the array map of format variables to values. - * - * @param bool $finish Forces the end result - * - * @return array Array of format vars and values - */ - private function generate($finish = false) - { - $vars = array(); - $percent = 0; - if ($this->max > 0) { - $percent = (float) $this->current / $this->max; - } - - if (isset($this->formatVars['bar'])) { - $completeBars = 0; - - if ($this->max > 0) { - $completeBars = floor($percent * $this->barWidth); - } else { - if (!$finish) { - $completeBars = floor($this->current % $this->barWidth); - } else { - $completeBars = $this->barWidth; - } - } - - $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar); - $bar = str_repeat($this->barChar, $completeBars); - if ($completeBars < $this->barWidth) { - $bar .= $this->progressChar; - $bar .= str_repeat($this->emptyBarChar, $emptyBars); - } - - $vars['bar'] = $bar; - } - - if (isset($this->formatVars['elapsed'])) { - $elapsed = time() - $this->startTime; - $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT); - } - - if (isset($this->formatVars['current'])) { - $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT); - } - - if (isset($this->formatVars['max'])) { - $vars['max'] = $this->max; - } - - if (isset($this->formatVars['percent'])) { - $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT); - } - - return $vars; - } - - /** - * Converts seconds into human-readable format. - * - * @param int $secs Number of seconds - * - * @return string Time in readable format - */ - private function humaneTime($secs) - { - $text = ''; - foreach ($this->timeFormats as $format) { - if ($secs < $format[0]) { - if (count($format) == 2) { - $text = $format[1]; - break; - } else { - $text = ceil($secs / $format[2]).' '.$format[1]; - break; - } - } - } - - return $text; - } - - /** - * Overwrites a previous message to the output. - * - * @param OutputInterface $output An Output instance - * @param string $message The message - */ - private function overwrite(OutputInterface $output, $message) - { - $length = $this->strlen($message); - - // append whitespace to match the last line's length - if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) { - $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT); - } - - // carriage return - $output->write("\x0D"); - $output->write($message); - - $this->lastMessagesLength = $this->strlen($message); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'progress'; - } -} diff --git a/src/Symfony/Component/Console/Helper/TableHelper.php b/src/Symfony/Component/Console/Helper/TableHelper.php deleted file mode 100644 index eec3f362a3673..0000000000000 --- a/src/Symfony/Component/Console/Helper/TableHelper.php +++ /dev/null @@ -1,267 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\NullOutput; - -/** - * Provides helpers to display table output. - * - * @author Саша Стаменковић - * @author Fabien Potencier - * - * @deprecated Deprecated since 2.5, to be removed in 3.0; use Table instead. - */ -class TableHelper extends Helper -{ - const LAYOUT_DEFAULT = 0; - const LAYOUT_BORDERLESS = 1; - const LAYOUT_COMPACT = 2; - - /** - * @var Table - */ - private $table; - - public function __construct($triggerDeprecationError = true) - { - if ($triggerDeprecationError) { - trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED); - } - - $this->table = new Table(new NullOutput()); - } - - /** - * Sets table layout type. - * - * @param int $layout self::LAYOUT_* - * - * @return TableHelper - * - * @throws \InvalidArgumentException when the table layout is not known - */ - public function setLayout($layout) - { - switch ($layout) { - case self::LAYOUT_BORDERLESS: - $this->table->setStyle('borderless'); - break; - - case self::LAYOUT_COMPACT: - $this->table->setStyle('compact'); - break; - - case self::LAYOUT_DEFAULT: - $this->table->setStyle('default'); - break; - - default: - throw new \InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout)); - }; - - return $this; - } - - public function setHeaders(array $headers) - { - $this->table->setHeaders($headers); - - return $this; - } - - public function setRows(array $rows) - { - $this->table->setRows($rows); - - return $this; - } - - public function addRows(array $rows) - { - $this->table->addRows($rows); - - return $this; - } - - public function addRow(array $row) - { - $this->table->addRow($row); - - return $this; - } - - public function setRow($column, array $row) - { - $this->table->setRow($column, $row); - - return $this; - } - - /** - * Sets padding character, used for cell padding. - * - * @param string $paddingChar - * - * @return TableHelper - */ - public function setPaddingChar($paddingChar) - { - $this->table->getStyle()->setPaddingChar($paddingChar); - - return $this; - } - - /** - * Sets horizontal border character. - * - * @param string $horizontalBorderChar - * - * @return TableHelper - */ - public function setHorizontalBorderChar($horizontalBorderChar) - { - $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar); - - return $this; - } - - /** - * Sets vertical border character. - * - * @param string $verticalBorderChar - * - * @return TableHelper - */ - public function setVerticalBorderChar($verticalBorderChar) - { - $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar); - - return $this; - } - - /** - * Sets crossing character. - * - * @param string $crossingChar - * - * @return TableHelper - */ - public function setCrossingChar($crossingChar) - { - $this->table->getStyle()->setCrossingChar($crossingChar); - - return $this; - } - - /** - * Sets header cell format. - * - * @param string $cellHeaderFormat - * - * @return TableHelper - */ - public function setCellHeaderFormat($cellHeaderFormat) - { - $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat); - - return $this; - } - - /** - * Sets row cell format. - * - * @param string $cellRowFormat - * - * @return TableHelper - */ - public function setCellRowFormat($cellRowFormat) - { - $this->table->getStyle()->setCellHeaderFormat($cellRowFormat); - - return $this; - } - - /** - * Sets row cell content format. - * - * @param string $cellRowContentFormat - * - * @return TableHelper - */ - public function setCellRowContentFormat($cellRowContentFormat) - { - $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat); - - return $this; - } - - /** - * Sets table border format. - * - * @param string $borderFormat - * - * @return TableHelper - */ - public function setBorderFormat($borderFormat) - { - $this->table->getStyle()->setBorderFormat($borderFormat); - - return $this; - } - - /** - * Sets cell padding type. - * - * @param int $padType STR_PAD_* - * - * @return TableHelper - */ - public function setPadType($padType) - { - $this->table->getStyle()->setPadType($padType); - - return $this; - } - - /** - * Renders table to output. - * - * Example: - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * - * @param OutputInterface $output - */ - public function render(OutputInterface $output) - { - $p = new \ReflectionProperty($this->table, 'output'); - $p->setAccessible(true); - $p->setValue($this->table, $output); - - $this->table->render(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'table'; - } -} diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 27cf58775e231..a280845c58bcb 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -749,8 +749,6 @@ public function testGetDefaultHelperSetReturnsDefaultValues() $helperSet = $application->getHelperSet(); $this->assertTrue($helperSet->has('formatter')); - $this->assertTrue($helperSet->has('dialog')); - $this->assertTrue($helperSet->has('progress')); } public function testAddingSingleHelperSetOverwritesDefaultValues() diff --git a/src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.php deleted file mode 100644 index e8404a4a687d3..0000000000000 --- a/src/Symfony/Component/Console/Tests/Helper/DialogHelperTest.php +++ /dev/null @@ -1,192 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Helper; - -use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Helper\DialogHelper; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Helper\FormatterHelper; -use Symfony\Component\Console\Output\StreamOutput; - -class DialogHelperTest extends \PHPUnit_Framework_TestCase -{ - public function testSelect() - { - $dialog = new DialogHelper(); - - $helperSet = new HelperSet(array(new FormatterHelper())); - $dialog->setHelperSet($helperSet); - - $heroes = array('Superman', 'Batman', 'Spiderman'); - - $dialog->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); - $this->assertEquals('2', $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, '2')); - $this->assertEquals('1', $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes)); - $this->assertEquals('1', $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes)); - $this->assertEquals('1', $dialog->select($output = $this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', false)); - - rewind($output->getStream()); - $this->assertContains('Input "Fabien" is not a superhero!', stream_get_contents($output->getStream())); - - try { - $this->assertEquals('1', $dialog->select($output = $this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, 1)); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertEquals('Value "Fabien" is invalid', $e->getMessage()); - } - - $this->assertEquals(array('1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', true)); - $this->assertEquals(array('0', '2'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', true)); - $this->assertEquals(array('0', '2'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', true)); - $this->assertEquals(array('0', '1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, '0,1', false, 'Input "%s" is not a superhero!', true)); - $this->assertEquals(array('0', '1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, ' 0 , 1 ', false, 'Input "%s" is not a superhero!', true)); - } - - public function testAsk() - { - $dialog = new DialogHelper(); - - $dialog->setInputStream($this->getInputStream("\n8AM\n")); - - $this->assertEquals('2PM', $dialog->ask($this->getOutputStream(), 'What time is it?', '2PM')); - $this->assertEquals('8AM', $dialog->ask($output = $this->getOutputStream(), 'What time is it?', '2PM')); - - rewind($output->getStream()); - $this->assertEquals('What time is it?', stream_get_contents($output->getStream())); - } - - public function testAskWithAutocomplete() - { - if (!$this->hasSttyAvailable()) { - $this->markTestSkipped('`stty` is required to test autocomplete functionality'); - } - - // Acm - // AcsTest - // - // - // Test - // - // S - // F00oo - $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); - - $dialog = new DialogHelper(); - $dialog->setInputStream($inputStream); - - $bundles = array('AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle'); - - $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('AsseticBundleTest', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('FrameworkBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('SecurityBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('FooBundleTest', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('AsseticBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - $this->assertEquals('FooBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); - } - - /** - * @group tty - */ - public function testAskHiddenResponse() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('This test is not supported on Windows'); - } - - $dialog = new DialogHelper(); - - $dialog->setInputStream($this->getInputStream("8AM\n")); - - $this->assertEquals('8AM', $dialog->askHiddenResponse($this->getOutputStream(), 'What time is it?')); - } - - public function testAskConfirmation() - { - $dialog = new DialogHelper(); - - $dialog->setInputStream($this->getInputStream("\n\n")); - $this->assertTrue($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?')); - $this->assertFalse($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', false)); - - $dialog->setInputStream($this->getInputStream("y\nyes\n")); - $this->assertTrue($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', false)); - $this->assertTrue($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', false)); - - $dialog->setInputStream($this->getInputStream("n\nno\n")); - $this->assertFalse($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', true)); - $this->assertFalse($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', true)); - } - - public function testAskAndValidate() - { - $dialog = new DialogHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); - $dialog->setHelperSet($helperSet); - - $question = 'What color was the white horse of Henry IV?'; - $error = 'This is not a color!'; - $validator = function ($color) use ($error) { - if (!in_array($color, array('white', 'black'))) { - throw new \InvalidArgumentException($error); - } - - return $color; - }; - - $dialog->setInputStream($this->getInputStream("\nblack\n")); - $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); - $this->assertEquals('black', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); - - $dialog->setInputStream($this->getInputStream("green\nyellow\norange\n")); - try { - $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertEquals($error, $e->getMessage()); - } - } - - public function testNoInteraction() - { - $dialog = new DialogHelper(); - - $input = new ArrayInput(array()); - $input->setInteractive(false); - - $dialog->setInput($input); - - $this->assertEquals('not yet', $dialog->ask($this->getOutputStream(), 'Do you have a job?', 'not yet')); - } - - protected function getInputStream($input) - { - $stream = fopen('php://memory', 'r+', false); - fputs($stream, $input); - rewind($stream); - - return $stream; - } - - protected function getOutputStream() - { - return new StreamOutput(fopen('php://memory', 'r+', false)); - } - - private function hasSttyAvailable() - { - exec('stty 2>&1', $output, $exitcode); - - return $exitcode === 0; - } -} diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php deleted file mode 100644 index 7bc475fce001b..0000000000000 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php +++ /dev/null @@ -1,224 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Helper; - -use Symfony\Component\Console\Helper\ProgressHelper; -use Symfony\Component\Console\Output\StreamOutput; - -class ProgressHelperTest extends \PHPUnit_Framework_TestCase -{ - public function testAdvance() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream()); - $progress->advance(); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 1 [->--------------------------]'), stream_get_contents($output->getStream())); - } - - public function testAdvanceWithStep() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream()); - $progress->advance(5); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); - } - - public function testAdvanceMultipleTimes() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream()); - $progress->advance(3); - $progress->advance(2); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 3 [--->------------------------]').$this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); - } - - public function testCustomizations() - { - $progress = new ProgressHelper(); - $progress->setBarWidth(10); - $progress->setBarCharacter('_'); - $progress->setEmptyBarCharacter(' '); - $progress->setProgressCharacter('/'); - $progress->setFormat(' %current%/%max% [%bar%] %percent%%'); - $progress->start($output = $this->getOutputStream(), 10); - $progress->advance(); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 1/10 [_/ ] 10%'), stream_get_contents($output->getStream())); - } - - public function testPercent() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream(), 50); - $progress->display(); - $progress->advance(); - $progress->advance(); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%').$this->generateOutput(' 1/50 [>---------------------------] 2%').$this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream())); - } - - public function testOverwriteWithShorterLine() - { - $progress = new ProgressHelper(); - $progress->setFormat(' %current%/%max% [%bar%] %percent%%'); - $progress->start($output = $this->getOutputStream(), 50); - $progress->display(); - $progress->advance(); - - // set shorter format - $progress->setFormat(' %current%/%max% [%bar%]'); - $progress->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 1/50 [>---------------------------] 2%'). - $this->generateOutput(' 2/50 [=>--------------------------] '), - stream_get_contents($output->getStream()) - ); - } - - public function testSetCurrentProgress() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream(), 50); - $progress->display(); - $progress->advance(); - $progress->setCurrent(15); - $progress->setCurrent(25); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 1/50 [>---------------------------] 2%'). - $this->generateOutput(' 15/50 [========>-------------------] 30%'). - $this->generateOutput(' 25/50 [==============>-------------] 50%'), - stream_get_contents($output->getStream()) - ); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage You must start the progress bar - */ - public function testSetCurrentBeforeStarting() - { - $progress = new ProgressHelper(); - $progress->setCurrent(15); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage You can't regress the progress bar - */ - public function testRegressProgress() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream(), 50); - $progress->setCurrent(15); - $progress->setCurrent(10); - } - - public function testRedrawFrequency() - { - $progress = $this->getMock('Symfony\Component\Console\Helper\ProgressHelper', array('display')); - $progress->expects($this->exactly(4)) - ->method('display'); - - $progress->setRedrawFrequency(2); - - $progress->start($output = $this->getOutputStream(), 6); - $progress->setCurrent(1); - $progress->advance(2); - $progress->advance(2); - $progress->advance(1); - } - - public function testMultiByteSupport() - { - if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) { - $this->markTestSkipped('The mbstring extension is needed for multi-byte support'); - } - - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream()); - $progress->setBarCharacter('■'); - $progress->advance(3); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 3 [■■■>------------------------]'), stream_get_contents($output->getStream())); - } - - public function testClear() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream(), 50); - $progress->setCurrent(25); - $progress->clear(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 25/50 [==============>-------------] 50%').$this->generateOutput(''), - stream_get_contents($output->getStream()) - ); - } - - public function testPercentNotHundredBeforeComplete() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream(), 200); - $progress->display(); - $progress->advance(199); - $progress->advance(); - - rewind($output->getStream()); - $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%').$this->generateOutput(' 199/200 [===========================>] 99%').$this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream())); - } - - public function testNonDecoratedOutput() - { - $progress = new ProgressHelper(); - $progress->start($output = $this->getOutputStream(false)); - $progress->advance(); - - rewind($output->getStream()); - $this->assertEquals('', stream_get_contents($output->getStream())); - } - - protected function getOutputStream($decorated = true) - { - return new StreamOutput(fopen('php://memory', 'r+', false), StreamOutput::VERBOSITY_NORMAL, $decorated); - } - - protected $lastMessagesLength; - - protected function generateOutput($expected) - { - $expectedout = $expected; - - if ($this->lastMessagesLength !== null) { - $expectedout = str_pad($expected, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT); - } - - $this->lastMessagesLength = strlen($expectedout); - - return "\x0D".$expectedout; - } -} diff --git a/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php deleted file mode 100644 index f3cda0dabf9c1..0000000000000 --- a/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php +++ /dev/null @@ -1,294 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Helper; - -use Symfony\Component\Console\Helper\TableHelper; -use Symfony\Component\Console\Output\StreamOutput; - -class TableHelperTest extends \PHPUnit_Framework_TestCase -{ - protected $stream; - - protected function setUp() - { - $this->stream = fopen('php://memory', 'r+'); - } - - protected function tearDown() - { - fclose($this->stream); - $this->stream = null; - } - - /** - * @dataProvider testRenderProvider - */ - public function testRender($headers, $rows, $layout, $expected) - { - $table = new TableHelper(); - $table - ->setHeaders($headers) - ->setRows($rows) - ->setLayout($layout) - ; - $table->render($output = $this->getOutputStream()); - - $this->assertEquals($expected, $this->getOutputContent($output)); - } - - /** - * @dataProvider testRenderProvider - */ - public function testRenderAddRows($headers, $rows, $layout, $expected) - { - $table = new TableHelper(); - $table - ->setHeaders($headers) - ->addRows($rows) - ->setLayout($layout) - ; - $table->render($output = $this->getOutputStream()); - - $this->assertEquals($expected, $this->getOutputContent($output)); - } - - /** - * @dataProvider testRenderProvider - */ - public function testRenderAddRowsOneByOne($headers, $rows, $layout, $expected) - { - $table = new TableHelper(); - $table - ->setHeaders($headers) - ->setLayout($layout) - ; - foreach ($rows as $row) { - $table->addRow($row); - } - $table->render($output = $this->getOutputStream()); - - $this->assertEquals($expected, $this->getOutputContent($output)); - } - - public function testRenderProvider() - { - $books = array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), - array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), - ); - - return array( - array( - array('ISBN', 'Title', 'Author'), - $books, - TableHelper::LAYOUT_DEFAULT, -<< array( - array('ISBN', 'Title', 'Author'), - array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - ), - TableHelper::LAYOUT_DEFAULT, -<<
array( - array('ISBN', 'Title', 'Author'), - array( - array('99921-58-10-700', 'Divine Com', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - ), - TableHelper::LAYOUT_DEFAULT, -<<
99921-58-10-700 | Divine Com | Dante Alighieri | -| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | -+----------------------------------+----------------------+-----------------+ - -TABLE - ), - ); - } - - public function testRenderMultiByte() - { - if (!function_exists('mb_strlen')) { - $this->markTestSkipped('The "mbstring" extension is not available'); - } - - $table = new TableHelper(); - $table - ->setHeaders(array('■■')) - ->setRows(array(array(1234))) - ->setLayout(TableHelper::LAYOUT_DEFAULT) - ; - $table->render($output = $this->getOutputStream()); - - $expected = -<<
assertEquals($expected, $this->getOutputContent($output)); - } - - protected function getOutputStream() - { - return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false); - } - - protected function getOutputContent(StreamOutput $output) - { - rewind($output->getStream()); - - return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream())); - } -} From c6b049f4e06cef6bb47610cafcb0d42f3984e67f Mon Sep 17 00:00:00 2001 From: Saro0h Date: Fri, 26 Dec 2014 19:00:47 +0100 Subject: [PATCH 013/240] [Form] Removed deprecated form_enctype() --- .../Bridge/Twig/Extension/FormExtension.php | 1 - .../Bridge/Twig/Node/FormEnctypeNode.php | 28 ------------------- .../views/Form/form_div_layout.html.twig | 4 --- 3 files changed, 33 deletions(-) delete mode 100644 src/Symfony/Bridge/Twig/Node/FormEnctypeNode.php diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index fff092f012cb0..015c892289c6c 100644 --- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -61,7 +61,6 @@ public function getTokenParsers() public function getFunctions() { return array( - new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'))), new \Twig_SimpleFunction('form_widget', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), new \Twig_SimpleFunction('form_errors', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), new \Twig_SimpleFunction('form_label', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), diff --git a/src/Symfony/Bridge/Twig/Node/FormEnctypeNode.php b/src/Symfony/Bridge/Twig/Node/FormEnctypeNode.php deleted file mode 100644 index 447a54c448d05..0000000000000 --- a/src/Symfony/Bridge/Twig/Node/FormEnctypeNode.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -/** - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use - * the helper "form_start()" instead. - */ -class FormEnctypeNode extends SearchAndRenderBlockNode -{ - public function compile(\Twig_Compiler $compiler) - { - parent::compile($compiler); - - $compiler->write('trigger_error(\'The helper form_enctype(form) is deprecated since version 2.3 and will be removed in 3.0. Use form_start(form) instead.\', E_USER_DEPRECATED)'); - } -} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 8938637548bb6..1d25570db8457 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -281,10 +281,6 @@ {%- endblock form_end %} -{% block form_enctype -%} - {% if multipart %}enctype="multipart/form-data"{% endif %} -{%- endblock form_enctype %} - {% block form_errors -%} {% if errors|length > 0 -%}
    From e93b571ab52a2eb672db1fcce9b33ac8495e6f33 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Fri, 26 Dec 2014 19:26:05 +0100 Subject: [PATCH 014/240] [HttpKernel] Removed deprecated ErrorHandler and ExceptionHandler classes --- .../HttpKernel/Debug/ErrorHandler.php | 27 ------------------- .../HttpKernel/Debug/ExceptionHandler.php | 27 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php delete mode 100644 src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php diff --git a/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php deleted file mode 100644 index 38203d4adf7ff..0000000000000 --- a/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -trigger_error('Symfony\Component\HttpKernel\Debug\ErrorHandler is deprecated since version 2.3 and will be removed in 3.0. Use the same class from the Debug component instead.', E_USER_DEPRECATED); - -use Symfony\Component\Debug\ErrorHandler as DebugErrorHandler; - -/** - * ErrorHandler. - * - * @author Fabien Potencier - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class ErrorHandler extends DebugErrorHandler -{ -} diff --git a/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php deleted file mode 100644 index 7e31b090c284a..0000000000000 --- a/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -trigger_error('Symfony\Component\HttpKernel\Debug\ExceptionHandler is deprecated since version 2.3 and will be removed in 3.0. Use the same class from the Debug component instead.', E_USER_DEPRECATED); - -use Symfony\Component\Debug\ExceptionHandler as DebugExceptionHandler; - -/** - * ExceptionHandler converts an exception to a Response object. - * - * @author Fabien Potencier - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class ExceptionHandler extends DebugExceptionHandler -{ -} From b552b1b18276d10db2480fb40df0e54882b4fbe0 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Fri, 26 Dec 2014 18:51:38 +0100 Subject: [PATCH 015/240] [FrameworkBundle] Removed the deprecated RouterApacheDumperCommand --- .../Command/RouterApacheDumperCommand.php | 93 ------ .../Routing/Matcher/ApacheUrlMatcher.php | 124 -------- .../Matcher/Dumper/ApacheMatcherDumper.php | 283 ------------------ .../Tests/Matcher/ApacheUrlMatcherTest.php | 152 ---------- .../Dumper/ApacheMatcherDumperTest.php | 196 ------------ 5 files changed, 848 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php delete mode 100644 src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php delete mode 100644 src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php delete mode 100644 src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php delete mode 100644 src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php deleted file mode 100644 index 79cd7870f0583..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\FrameworkBundle\Command; - -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper; -use Symfony\Component\Routing\RouterInterface; - -/** - * RouterApacheDumperCommand. - * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * The performance gains are minimal and it's very hard to replicate - * the behavior of PHP implementation. - * - * @author Fabien Potencier - */ -class RouterApacheDumperCommand extends ContainerAwareCommand -{ - /** - * {@inheritdoc} - */ - public function isEnabled() - { - if (!$this->getContainer()->has('router')) { - return false; - } - $router = $this->getContainer()->get('router'); - if (!$router instanceof RouterInterface) { - return false; - } - - return parent::isEnabled(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('router:dump-apache') - ->setDefinition(array( - new InputArgument('script_name', InputArgument::OPTIONAL, 'The script name of the application\'s front controller.'), - new InputOption('base-uri', null, InputOption::VALUE_REQUIRED, 'The base URI'), - )) - ->setDescription('[DEPRECATED] Dumps all routes as Apache rewrite rules') - ->setHelp(<<%command.name% dumps all routes as Apache rewrite rules. -These can then be used with the ApacheUrlMatcher to use Apache for route -matching. - - php %command.full_name% - -EOF - ) - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - trigger_error('The router:dump-apache command is deprecated since 2.5 and will be removed in 3.0', E_USER_DEPRECATED); - - $router = $this->getContainer()->get('router'); - - $dumpOptions = array(); - if ($input->getArgument('script_name')) { - $dumpOptions['script_name'] = $input->getArgument('script_name'); - } - if ($input->getOption('base-uri')) { - $dumpOptions['base_uri'] = $input->getOption('base-uri'); - } - - $dumper = new ApacheMatcherDumper($router->getRouteCollection()); - - $output->writeln($dumper->dump($dumpOptions), OutputInterface::OUTPUT_RAW); - } -} diff --git a/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php deleted file mode 100644 index adc435c5cd487..0000000000000 --- a/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -trigger_error('The Symfony\Component\Routing\Matcher\Dumper\ApacheUrlMatcher is deprecated since it\'s hard to replicate the behaviour of the PHP implementation and the performance gains are minimal.', E_USER_DEPRECATED); - -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * ApacheUrlMatcher matches URL based on Apache mod_rewrite matching (see ApacheMatcherDumper). - * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * The performance gains are minimal and it's very hard to replicate - * the behavior of PHP implementation. - * - * @author Fabien Potencier - * @author Arnaud Le Blanc - */ -class ApacheUrlMatcher extends UrlMatcher -{ - /** - * Tries to match a URL based on Apache mod_rewrite matching. - * - * Returns false if no route matches the URL. - * - * @param string $pathinfo The pathinfo to be parsed - * - * @return array An array of parameters - * - * @throws MethodNotAllowedException If the current method is not allowed - */ - public function match($pathinfo) - { - $parameters = array(); - $defaults = array(); - $allow = array(); - $route = null; - - foreach ($this->denormalizeValues($_SERVER) as $key => $value) { - $name = $key; - - // skip non-routing variables - // this improves performance when $_SERVER contains many usual - // variables like HTTP_*, DOCUMENT_ROOT, REQUEST_URI, ... - if (false === strpos($name, '_ROUTING_')) { - continue; - } - - while (0 === strpos($name, 'REDIRECT_')) { - $name = substr($name, 9); - } - - // expect _ROUTING__ - // or _ROUTING_ - - if (0 !== strpos($name, '_ROUTING_')) { - continue; - } - if (false !== $pos = strpos($name, '_', 9)) { - $type = substr($name, 9, $pos-9); - $name = substr($name, $pos+1); - } else { - $type = substr($name, 9); - } - - if ('param' === $type) { - if ('' !== $value) { - $parameters[$name] = $value; - } - } elseif ('default' === $type) { - $defaults[$name] = $value; - } elseif ('route' === $type) { - $route = $value; - } elseif ('allow' === $type) { - $allow[] = $name; - } - - unset($_SERVER[$key]); - } - - if (null !== $route) { - $parameters['_route'] = $route; - - return $this->mergeDefaults($parameters, $defaults); - } elseif (0 < count($allow)) { - throw new MethodNotAllowedException($allow); - } else { - return parent::match($pathinfo); - } - } - - /** - * Denormalizes an array of values. - * - * @param string[] $values - * - * @return array - */ - private function denormalizeValues(array $values) - { - $normalizedValues = array(); - foreach ($values as $key => $value) { - if (preg_match('~^(.*)\[(\d+)\]$~', $key, $matches)) { - if (!isset($normalizedValues[$matches[1]])) { - $normalizedValues[$matches[1]] = array(); - } - $normalizedValues[$matches[1]][(int) $matches[2]] = $value; - } else { - $normalizedValues[$key] = $value; - } - } - - return $normalizedValues; - } -} diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php deleted file mode 100644 index b03d596bbd54e..0000000000000 --- a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ /dev/null @@ -1,283 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -trigger_error('The Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper is deprecated since it\'s hard to replicate the behaviour of the PHP implementation and the performance gains are minimal.', E_USER_DEPRECATED); - -use Symfony\Component\Routing\Route; - -/** - * Dumps a set of Apache mod_rewrite rules. - * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * The performance gains are minimal and it's very hard to replicate - * the behavior of PHP implementation. - * - * @author Fabien Potencier - * @author Kris Wallsmith - */ -class ApacheMatcherDumper extends MatcherDumper -{ - /** - * Dumps a set of Apache mod_rewrite rules. - * - * Available options: - * - * * script_name: The script name (app.php by default) - * * base_uri: The base URI ("" by default) - * - * @param array $options An array of options - * - * @return string A string to be used as Apache rewrite rules - * - * @throws \LogicException When the route regex is invalid - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'script_name' => 'app.php', - 'base_uri' => '', - ), $options); - - $options['script_name'] = self::escape($options['script_name'], ' ', '\\'); - - $rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]"); - $methodVars = array(); - $hostRegexUnique = 0; - $prevHostRegex = ''; - - foreach ($this->getRoutes()->all() as $name => $route) { - if ($route->getCondition()) { - throw new \LogicException(sprintf('Unable to dump the routes for Apache as route "%s" has a condition.', $name)); - } - - $compiledRoute = $route->compile(); - $hostRegex = $compiledRoute->getHostRegex(); - - if (null !== $hostRegex && $prevHostRegex !== $hostRegex) { - $prevHostRegex = $hostRegex; - $hostRegexUnique++; - - $rule = array(); - - $regex = $this->regexToApacheRegex($hostRegex); - $regex = self::escape($regex, ' ', '\\'); - - $rule[] = sprintf('RewriteCond %%{HTTP:Host} %s', $regex); - - $variables = array(); - $variables[] = sprintf('E=__ROUTING_host_%s:1', $hostRegexUnique); - - foreach ($compiledRoute->getHostVariables() as $i => $variable) { - $variables[] = sprintf('E=__ROUTING_host_%s_%s:%%%d', $hostRegexUnique, $variable, $i+1); - } - - $variables = implode(',', $variables); - - $rule[] = sprintf('RewriteRule .? - [%s]', $variables); - - $rules[] = implode("\n", $rule); - } - - $rules[] = $this->dumpRoute($name, $route, $options, $hostRegexUnique); - - if ($req = $route->getRequirement('_method')) { - $methods = explode('|', strtoupper($req)); - $methodVars = array_merge($methodVars, $methods); - } - } - if (0 < count($methodVars)) { - $rule = array('# 405 Method Not Allowed'); - $methodVars = array_values(array_unique($methodVars)); - if (in_array('GET', $methodVars) && !in_array('HEAD', $methodVars)) { - $methodVars[] = 'HEAD'; - } - foreach ($methodVars as $i => $methodVar) { - $rule[] = sprintf('RewriteCond %%{ENV:_ROUTING__allow_%s} =1%s', $methodVar, isset($methodVars[$i + 1]) ? ' [OR]' : ''); - } - $rule[] = sprintf('RewriteRule .* %s [QSA,L]', $options['script_name']); - - $rules[] = implode("\n", $rule); - } - - return implode("\n\n", $rules)."\n"; - } - - /** - * Dumps a single route. - * - * @param string $name Route name - * @param Route $route The route - * @param array $options Options - * @param bool $hostRegexUnique Unique identifier for the host regex - * - * @return string The compiled route - */ - private function dumpRoute($name, $route, array $options, $hostRegexUnique) - { - $compiledRoute = $route->compile(); - - // prepare the apache regex - $regex = $this->regexToApacheRegex($compiledRoute->getRegex()); - $regex = '^'.self::escape(preg_quote($options['base_uri']).substr($regex, 1), ' ', '\\'); - - $methods = $this->getRouteMethods($route); - - $hasTrailingSlash = (!$methods || in_array('HEAD', $methods)) && '/$' === substr($regex, -2) && '^/$' !== $regex; - - $variables = array('E=_ROUTING_route:'.$name); - foreach ($compiledRoute->getHostVariables() as $variable) { - $variables[] = sprintf('E=_ROUTING_param_%s:%%{ENV:__ROUTING_host_%s_%s}', $variable, $hostRegexUnique, $variable); - } - foreach ($compiledRoute->getPathVariables() as $i => $variable) { - $variables[] = 'E=_ROUTING_param_'.$variable.':%'.($i + 1); - } - foreach ($this->normalizeValues($route->getDefaults()) as $key => $value) { - $variables[] = 'E=_ROUTING_default_'.$key.':'.strtr($value, array( - ':' => '\\:', - '=' => '\\=', - '\\' => '\\\\', - ' ' => '\\ ', - )); - } - $variables = implode(',', $variables); - - $rule = array("# $name"); - - // method mismatch - if (0 < count($methods)) { - $allow = array(); - foreach ($methods as $method) { - $allow[] = 'E=_ROUTING_allow_'.$method.':1'; - } - - if ($compiledRoute->getHostRegex()) { - $rule[] = sprintf("RewriteCond %%{ENV:__ROUTING_host_%s} =1", $hostRegexUnique); - } - - $rule[] = "RewriteCond %{REQUEST_URI} $regex"; - $rule[] = sprintf("RewriteCond %%{REQUEST_METHOD} !^(%s)$ [NC]", implode('|', $methods)); - $rule[] = sprintf('RewriteRule .* - [S=%d,%s]', $hasTrailingSlash ? 2 : 1, implode(',', $allow)); - } - - // redirect with trailing slash appended - if ($hasTrailingSlash) { - if ($compiledRoute->getHostRegex()) { - $rule[] = sprintf("RewriteCond %%{ENV:__ROUTING_host_%s} =1", $hostRegexUnique); - } - - $rule[] = 'RewriteCond %{REQUEST_URI} '.substr($regex, 0, -2).'$'; - $rule[] = 'RewriteRule .* $0/ [QSA,L,R=301]'; - } - - // the main rule - - if ($compiledRoute->getHostRegex()) { - $rule[] = sprintf("RewriteCond %%{ENV:__ROUTING_host_%s} =1", $hostRegexUnique); - } - - $rule[] = "RewriteCond %{REQUEST_URI} $regex"; - $rule[] = "RewriteRule .* {$options['script_name']} [QSA,L,$variables]"; - - return implode("\n", $rule); - } - - /** - * Returns methods allowed for a route. - * - * @param Route $route The route - * - * @return array The methods - */ - private function getRouteMethods(Route $route) - { - $methods = array(); - if ($req = $route->getRequirement('_method')) { - $methods = explode('|', strtoupper($req)); - // GET and HEAD are equivalent - if (in_array('GET', $methods) && !in_array('HEAD', $methods)) { - $methods[] = 'HEAD'; - } - } - - return $methods; - } - - /** - * Converts a regex to make it suitable for mod_rewrite. - * - * @param string $regex The regex - * - * @return string The converted regex - */ - private function regexToApacheRegex($regex) - { - $regexPatternEnd = strrpos($regex, $regex[0]); - - return preg_replace('/\?P<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1)); - } - - /** - * Escapes a string. - * - * @param string $string The string to be escaped - * @param string $char The character to be escaped - * @param string $with The character to be used for escaping - * - * @return string The escaped string - */ - private static function escape($string, $char, $with) - { - $escaped = false; - $output = ''; - foreach (str_split($string) as $symbol) { - if ($escaped) { - $output .= $symbol; - $escaped = false; - continue; - } - if ($symbol === $char) { - $output .= $with.$char; - continue; - } - if ($symbol === $with) { - $escaped = true; - } - $output .= $symbol; - } - - return $output; - } - - /** - * Normalizes an array of values. - * - * @param array $values - * - * @return string[] - */ - private function normalizeValues(array $values) - { - $normalizedValues = array(); - foreach ($values as $key => $value) { - if (is_array($value)) { - foreach ($value as $index => $bit) { - $normalizedValues[sprintf('%s[%s]', $key, $index)] = $bit; - } - } else { - $normalizedValues[$key] = (string) $value; - } - } - - return $normalizedValues; - } -} diff --git a/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php deleted file mode 100644 index 05e6261a5f737..0000000000000 --- a/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Matcher\ApacheUrlMatcher; - -class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase -{ - protected $server; - - protected function setUp() - { - $this->server = $_SERVER; - } - - protected function tearDown() - { - $_SERVER = $this->server; - } - - /** - * @dataProvider getMatchData - */ - public function testMatch($name, $pathinfo, $server, $expect) - { - $collection = new RouteCollection(); - $context = new RequestContext(); - $matcher = new ApacheUrlMatcher($collection, $context); - - $_SERVER = $server; - - $result = $matcher->match($pathinfo); - $this->assertSame(var_export($expect, true), var_export($result, true)); - } - - public function getMatchData() - { - return array( - array( - 'Simple route', - '/hello/world', - array( - '_ROUTING_route' => 'hello', - '_ROUTING_param__controller' => 'AcmeBundle:Default:index', - '_ROUTING_param_name' => 'world', - ), - array( - '_controller' => 'AcmeBundle:Default:index', - 'name' => 'world', - '_route' => 'hello', - ), - ), - array( - 'Route with params and defaults', - '/hello/hugo', - array( - '_ROUTING_route' => 'hello', - '_ROUTING_param__controller' => 'AcmeBundle:Default:index', - '_ROUTING_param_name' => 'hugo', - '_ROUTING_default_name' => 'world', - ), - array( - 'name' => 'hugo', - '_controller' => 'AcmeBundle:Default:index', - '_route' => 'hello', - ), - ), - array( - 'Route with defaults only', - '/hello', - array( - '_ROUTING_route' => 'hello', - '_ROUTING_param__controller' => 'AcmeBundle:Default:index', - '_ROUTING_default_name' => 'world', - ), - array( - 'name' => 'world', - '_controller' => 'AcmeBundle:Default:index', - '_route' => 'hello', - ), - ), - array( - 'Redirect with many ignored attributes', - '/legacy/{cat1}/{cat2}/{id}.html', - array( - '_ROUTING_route' => 'product_view', - '_ROUTING_param__controller' => 'FrameworkBundle:Redirect:redirect', - '_ROUTING_default_ignoreAttributes[0]' => 'attr_a', - '_ROUTING_default_ignoreAttributes[1]' => 'attr_b', - ), - array( - 'ignoreAttributes' => array('attr_a', 'attr_b'), - '_controller' => 'FrameworkBundle:Redirect:redirect', - '_route' => 'product_view', - ), - ), - array( - 'REDIRECT_ envs', - '/hello/world', - array( - 'REDIRECT__ROUTING_route' => 'hello', - 'REDIRECT__ROUTING_param__controller' => 'AcmeBundle:Default:index', - 'REDIRECT__ROUTING_param_name' => 'world', - ), - array( - '_controller' => 'AcmeBundle:Default:index', - 'name' => 'world', - '_route' => 'hello', - ), - ), - array( - 'REDIRECT_REDIRECT_ envs', - '/hello/world', - array( - 'REDIRECT_REDIRECT__ROUTING_route' => 'hello', - 'REDIRECT_REDIRECT__ROUTING_param__controller' => 'AcmeBundle:Default:index', - 'REDIRECT_REDIRECT__ROUTING_param_name' => 'world', - ), - array( - '_controller' => 'AcmeBundle:Default:index', - 'name' => 'world', - '_route' => 'hello', - ), - ), - array( - 'REDIRECT_REDIRECT_ envs', - '/hello/world', - array( - 'REDIRECT_REDIRECT__ROUTING_route' => 'hello', - 'REDIRECT_REDIRECT__ROUTING_param__controller' => 'AcmeBundle:Default:index', - 'REDIRECT_REDIRECT__ROUTING_param_name' => 'world', - ), - array( - '_controller' => 'AcmeBundle:Default:index', - 'name' => 'world', - '_route' => 'hello', - ), - ), - ); - } -} diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php deleted file mode 100644 index 72bee7100228b..0000000000000 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php +++ /dev/null @@ -1,196 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher\Dumper; - -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper; - -class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase -{ - protected static $fixturesPath; - - public static function setUpBeforeClass() - { - self::$fixturesPath = realpath(__DIR__.'/../../Fixtures/'); - } - - public function testDump() - { - $dumper = new ApacheMatcherDumper($this->getRouteCollection()); - - $this->assertStringEqualsFile(self::$fixturesPath.'/dumper/url_matcher1.apache', $dumper->dump(), '->dump() dumps basic routes to the correct apache format.'); - } - - /** - * @dataProvider provideEscapeFixtures - */ - public function testEscapePattern($src, $dest, $char, $with, $message) - { - $r = new \ReflectionMethod(new ApacheMatcherDumper($this->getRouteCollection()), 'escape'); - $r->setAccessible(true); - $this->assertEquals($dest, $r->invoke(null, $src, $char, $with), $message); - } - - public function provideEscapeFixtures() - { - return array( - array('foo', 'foo', ' ', '-', 'Preserve string that should not be escaped'), - array('fo-o', 'fo-o', ' ', '-', 'Preserve string that should not be escaped'), - array('fo o', 'fo- o', ' ', '-', 'Escape special characters'), - array('fo-- o', 'fo--- o', ' ', '-', 'Escape special characters'), - array('fo- o', 'fo- o', ' ', '-', 'Do not escape already escaped string'), - ); - } - - public function testEscapeScriptName() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - $dumper = new ApacheMatcherDumper($collection); - $this->assertStringEqualsFile(self::$fixturesPath.'/dumper/url_matcher2.apache', $dumper->dump(array('script_name' => 'ap p_d\ ev.php'))); - } - - private function getRouteCollection() - { - $collection = new RouteCollection(); - - // defaults and requirements - $collection->add('foo', new Route( - '/foo/{bar}', - array('def' => 'test'), - array('bar' => 'baz|symfony') - )); - // defaults parameters in pattern - $collection->add('foobar', new Route( - '/foo/{bar}', - array('bar' => 'toto') - )); - // method requirement - $collection->add('bar', new Route( - '/bar/{foo}', - array(), - array('_method' => 'GET|head') - )); - // method requirement (again) - $collection->add('baragain', new Route( - '/baragain/{foo}', - array(), - array('_method' => 'get|post') - )); - // simple - $collection->add('baz', new Route( - '/test/baz' - )); - // simple with extension - $collection->add('baz2', new Route( - '/test/baz.html' - )); - // trailing slash - $collection->add('baz3', new Route( - '/test/baz3/' - )); - // trailing slash with variable - $collection->add('baz4', new Route( - '/test/{foo}/' - )); - // trailing slash and safe method - $collection->add('baz5', new Route( - '/test/{foo}/', - array(), - array('_method' => 'get') - )); - // trailing slash and unsafe method - $collection->add('baz5unsafe', new Route( - '/testunsafe/{foo}/', - array(), - array('_method' => 'post') - )); - // complex - $collection->add('baz6', new Route( - '/test/baz', - array('foo' => 'bar baz') - )); - // space in path - $collection->add('baz7', new Route( - '/te st/baz' - )); - // space preceded with \ in path - $collection->add('baz8', new Route( - '/te\\ st/baz' - )); - // space preceded with \ in requirement - $collection->add('baz9', new Route( - '/test/{baz}', - array(), - array( - 'baz' => 'te\\\\ st', - ) - )); - - $collection1 = new RouteCollection(); - - $route1 = new Route('/route1', array(), array(), array(), 'a.example.com'); - $collection1->add('route1', $route1); - - $collection2 = new RouteCollection(); - - $route2 = new Route('/route2', array(), array(), array(), 'a.example.com'); - $collection2->add('route2', $route2); - - $route3 = new Route('/route3', array(), array(), array(), 'b.example.com'); - $collection2->add('route3', $route3); - - $collection2->addPrefix('/c2'); - $collection1->addCollection($collection2); - - $route4 = new Route('/route4', array(), array(), array(), 'a.example.com'); - $collection1->add('route4', $route4); - - $route5 = new Route('/route5', array(), array(), array(), 'c.example.com'); - $collection1->add('route5', $route5); - - $route6 = new Route('/route6', array(), array(), array(), null); - $collection1->add('route6', $route6); - - $collection->addCollection($collection1); - - // host and variables - - $collection1 = new RouteCollection(); - - $route11 = new Route('/route11', array(), array(), array(), '{var1}.example.com'); - $collection1->add('route11', $route11); - - $route12 = new Route('/route12', array('var1' => 'val'), array(), array(), '{var1}.example.com'); - $collection1->add('route12', $route12); - - $route13 = new Route('/route13/{name}', array(), array(), array(), '{var1}.example.com'); - $collection1->add('route13', $route13); - - $route14 = new Route('/route14/{name}', array('var1' => 'val'), array(), array(), '{var1}.example.com'); - $collection1->add('route14', $route14); - - $route15 = new Route('/route15/{name}', array(), array(), array(), 'c.example.com'); - $collection1->add('route15', $route15); - - $route16 = new Route('/route16/{name}', array('var1' => 'val'), array(), array(), null); - $collection1->add('route16', $route16); - - $route17 = new Route('/route17', array(), array(), array(), null); - $collection1->add('route17', $route17); - - $collection->addCollection($collection1); - - return $collection; - } -} From e1c19f8941d0079d44f35282b6307dd9b346059b Mon Sep 17 00:00:00 2001 From: Saro0h Date: Fri, 26 Dec 2014 19:16:39 +0100 Subject: [PATCH 016/240] [Yaml] Removed the ability to parse a file in Yaml::parse() --- src/Symfony/Component/Yaml/Tests/YamlTest.php | 9 ------ src/Symfony/Component/Yaml/Yaml.php | 31 ++----------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/Symfony/Component/Yaml/Tests/YamlTest.php b/src/Symfony/Component/Yaml/Tests/YamlTest.php index 53b0bfaaebfee..ee008cf1cd140 100644 --- a/src/Symfony/Component/Yaml/Tests/YamlTest.php +++ b/src/Symfony/Component/Yaml/Tests/YamlTest.php @@ -22,13 +22,4 @@ public function testParseAndDump() $parsed = Yaml::parse($yml); $this->assertEquals($data, $parsed); } - - public function testParseFromFile() - { - $filename = __DIR__.'/Fixtures/index.yml'; - $contents = file_get_contents($filename); - $parsedByFilename = Yaml::parse($filename); - $parsedByContents = Yaml::parse($contents); - $this->assertEquals($parsedByFilename, $parsedByContents); - } } diff --git a/src/Symfony/Component/Yaml/Yaml.php b/src/Symfony/Component/Yaml/Yaml.php index 0c3ada73568dc..7d9e298169b53 100644 --- a/src/Symfony/Component/Yaml/Yaml.php +++ b/src/Symfony/Component/Yaml/Yaml.php @@ -34,11 +34,7 @@ class Yaml * print_r($array); * * - * As this method accepts both plain strings and file names as an input, - * you must validate the input before calling this method. Passing a file - * as an input is a deprecated feature and will be removed in 3.0. - * - * @param string $input Path to a YAML file or a string containing YAML + * @param string $input A string containing YAML * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise * @param bool $objectSupport True if object support is enabled, false otherwise * @@ -46,36 +42,13 @@ class Yaml * * @throws ParseException If the YAML is not valid * - * @deprecated The ability to pass file names to Yaml::parse() was deprecated in 2.2 and will be removed in 3.0. Please, pass the contents of the file instead. - * * @api */ public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false) { - // if input is a file, process it - $file = ''; - if (strpos($input, "\n") === false && is_file($input)) { - trigger_error('The ability to pass file names to Yaml::parse() was deprecated in 2.2 and will be removed in 3.0. Please, pass the contents of the file instead.', E_USER_DEPRECATED); - - if (false === is_readable($input)) { - throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $input)); - } - - $file = $input; - $input = file_get_contents($file); - } - $yaml = new Parser(); - try { - return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport); - } catch (ParseException $e) { - if ($file) { - $e->setParsedFile($file); - } - - throw $e; - } + return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport); } /** From fddcb86c31a7bde7b70bad8c3e3d2c45bf8588c5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 19 Nov 2014 22:23:28 +0100 Subject: [PATCH 017/240] [3.0] Update required PHP to 5.5.9 --- .travis.yml | 5 +- composer.json | 29 ++++++----- src/Symfony/Bridge/Doctrine/composer.json | 20 ++++---- src/Symfony/Bridge/Monolog/composer.json | 8 ++-- src/Symfony/Bridge/Propel1/composer.json | 12 ++--- src/Symfony/Bridge/ProxyManager/composer.json | 6 +-- src/Symfony/Bridge/Twig/composer.json | 30 ++++++------ src/Symfony/Bundle/DebugBundle/composer.json | 12 ++--- .../Bundle/FrameworkBundle/composer.json | 48 +++++++++---------- .../Bundle/SecurityBundle/composer.json | 34 ++++++------- src/Symfony/Bundle/TwigBundle/composer.json | 22 ++++----- .../Bundle/WebProfilerBundle/composer.json | 16 +++---- .../Component/BrowserKit/composer.json | 8 ++-- .../Component/ClassLoader/composer.json | 4 +- src/Symfony/Component/Config/composer.json | 4 +- src/Symfony/Component/Console/composer.json | 6 +-- .../Component/CssSelector/composer.json | 2 +- src/Symfony/Component/Debug/composer.json | 6 +-- .../DependencyInjection/composer.json | 8 ++-- .../Component/DomCrawler/composer.json | 4 +- .../Component/EventDispatcher/composer.json | 10 ++-- .../ExpressionLanguage/composer.json | 2 +- .../Component/Filesystem/composer.json | 2 +- src/Symfony/Component/Finder/composer.json | 2 +- src/Symfony/Component/Form/composer.json | 20 ++++---- .../Component/HttpFoundation/composer.json | 4 +- .../Component/HttpKernel/composer.json | 38 +++++++-------- src/Symfony/Component/Intl/composer.json | 4 +- src/Symfony/Component/Locale/composer.json | 4 +- .../Component/OptionsResolver/composer.json | 2 +- src/Symfony/Component/Process/composer.json | 2 +- .../Component/PropertyAccess/composer.json | 2 +- src/Symfony/Component/Routing/composer.json | 10 ++-- .../Component/Security/Acl/composer.json | 4 +- .../Component/Security/Core/composer.json | 18 ++++--- .../Component/Security/Csrf/composer.json | 6 +-- .../Component/Security/Http/composer.json | 14 +++--- src/Symfony/Component/Security/composer.json | 22 ++++----- .../Component/Serializer/composer.json | 6 +-- src/Symfony/Component/Stopwatch/composer.json | 2 +- .../Component/Templating/composer.json | 2 +- .../Component/Translation/composer.json | 8 ++-- src/Symfony/Component/Validator/composer.json | 16 +++---- src/Symfony/Component/VarDumper/composer.json | 2 +- src/Symfony/Component/Yaml/composer.json | 2 +- 45 files changed, 240 insertions(+), 248 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb1f213fa6f86..1e12bd699ad19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,10 @@ language: php matrix: include: - - php: 5.3.3 + - php: 5.5.9 env: components=low - php: 5.6 env: components=high - - php: 5.3.3 - - php: 5.3 - - php: 5.4 - php: 5.5 - php: 5.6 - php: hhvm-nightly diff --git a/composer.json b/composer.json index a0c83fd521f79..51c0e9a5853e8 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.5.9", "doctrine/common": "~2.3", "twig/twig": "~1.12,>=1.12.3", "psr/log": "~1.0" @@ -24,47 +24,47 @@ "replace": { "symfony/browser-kit": "self.version", "symfony/class-loader": "self.version", - "symfony/config": "self.version", - "symfony/console": "self.version", + "symfony/config": "2.99.99", + "symfony/console": "2.99.99", "symfony/css-selector": "self.version", - "symfony/dependency-injection": "self.version", + "symfony/dependency-injection": "2.99.99", "symfony/debug": "self.version", "symfony/debug-bundle": "self.version", - "symfony/doctrine-bridge": "self.version", + "symfony/doctrine-bridge": "2.99.99", "symfony/dom-crawler": "self.version", - "symfony/event-dispatcher": "self.version", - "symfony/expression-language": "self.version", - "symfony/filesystem": "self.version", + "symfony/event-dispatcher": "2.99.99", + "symfony/expression-language": "2.99.99", + "symfony/filesystem": "2.99.99", "symfony/finder": "self.version", "symfony/form": "self.version", - "symfony/framework-bundle": "self.version", + "symfony/framework-bundle": "2.99.99", "symfony/http-foundation": "self.version", "symfony/http-kernel": "self.version", "symfony/intl": "self.version", "symfony/locale": "self.version", "symfony/monolog-bridge": "self.version", "symfony/options-resolver": "self.version", - "symfony/process": "self.version", + "symfony/process": "2.99.99", "symfony/propel1-bridge": "self.version", "symfony/property-access": "self.version", "symfony/proxy-manager-bridge": "self.version", "symfony/routing": "self.version", - "symfony/security": "self.version", + "symfony/security": "2.99.99", "symfony/security-acl": "self.version", "symfony/security-core": "self.version", "symfony/security-csrf": "self.version", "symfony/security-http": "self.version", "symfony/security-bundle": "self.version", "symfony/serializer": "self.version", - "symfony/stopwatch": "self.version", + "symfony/stopwatch": "2.99.99", "symfony/templating": "self.version", "symfony/translation": "self.version", "symfony/twig-bridge": "self.version", "symfony/twig-bundle": "self.version", - "symfony/validator": "self.version", + "symfony/validator": "2.99.99", "symfony/var-dumper": "self.version", "symfony/web-profiler-bundle": "self.version", - "symfony/yaml": "self.version" + "symfony/yaml": "2.99.99" }, "require-dev": { "doctrine/data-fixtures": "1.0.*", @@ -73,7 +73,6 @@ "doctrine/doctrine-bundle": "~1.2", "monolog/monolog": "~1.11", "propel/propel1": "~1.6", - "ircmaxell/password-compat": "~1.0", "ocramius/proxy-manager": "~0.4|~1.0", "egulias/email-validator": "~1.2" }, diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 1624c0418795b..05935fac073e6 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -16,19 +16,19 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.5.9", "doctrine/common": "~2.3" }, "require-dev": { - "symfony/stopwatch": "~2.2|~3.0.0", - "symfony/dependency-injection": "~2.2|~3.0.0", - "symfony/form": "~2.3,>=2.3.8|~3.0.0", - "symfony/http-kernel": "~2.2|~3.0.0", - "symfony/property-access": "~2.3|~3.0.0", - "symfony/security": "~2.2|~3.0.0", - "symfony/expression-language": "~2.2|~3.0.0", - "symfony/validator": "~2.5,>=2.5.5|~3.0.0", - "symfony/translation": "~2.0,>=2.0.5|~3.0.0", + "symfony/stopwatch": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/form": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/property-access": "~2.7|~3.0", + "symfony/security": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", + "symfony/validator": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0", "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.2", "doctrine/orm": "~2.2,>=2.2.3" diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index e74c3920c6773..436b059722841 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -16,13 +16,13 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.5.9", "monolog/monolog": "~1.11" }, "require-dev": { - "symfony/http-kernel": "~2.4|~3.0.0", - "symfony/console": "~2.4|~3.0.0", - "symfony/event-dispatcher": "~2.2|~3.0.0" + "symfony/http-kernel": "~2.7|~3.0", + "symfony/console": "~2.7|~3.0", + "symfony/event-dispatcher": "~2.7|~3.0" }, "suggest": { "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", diff --git a/src/Symfony/Bridge/Propel1/composer.json b/src/Symfony/Bridge/Propel1/composer.json index 3132e49804c79..966d0d036c213 100644 --- a/src/Symfony/Bridge/Propel1/composer.json +++ b/src/Symfony/Bridge/Propel1/composer.json @@ -16,15 +16,15 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/http-foundation": "~2.0,>=2.0.5|~3.0.0", - "symfony/http-kernel": "~2.0,>=2.0.5|~3.0.0", - "symfony/form": "~2.3,>=2.3.8|~3.0.0", - "symfony/property-access": "~2.3|~3.0.0", + "php": ">=5.5.9", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/form": "~2.7|~3.0", + "symfony/property-access": "~2.7|~3.0", "propel/propel1": "~1.6,>=1.6.5" }, "require-dev": { - "symfony/stopwatch": "~2.2|~3.0.0" + "symfony/stopwatch": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Bridge\\Propel1\\": "" } diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index e5115b4e649e7..2fba72ffe7ca9 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -16,12 +16,12 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/dependency-injection": "~2.3|~3.0.0", + "php": ">=5.5.9", + "symfony/dependency-injection": "~2.7|~3.0", "ocramius/proxy-manager": "~0.4|~1.0" }, "require-dev": { - "symfony/config": "~2.3|~3.0.0" + "symfony/config": "~2.7|~3.0" }, "autoload": { "psr-0": { diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index e6066dfcbb561..11e35095d5bfe 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -16,24 +16,24 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/security-csrf": "~2.4|~3.0.0", + "php": ">=5.5.9", + "symfony/security-csrf": "~2.7|~3.0", "twig/twig": "~1.13,>=1.13.1" }, "require-dev": { - "symfony/finder": "~2.3|~3.0.0", - "symfony/form": "~2.6|~3.0.0", - "symfony/http-kernel": "~2.3|~3.0.0", - "symfony/locale": "~2.0,>=2.0.5|~3.0.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/templating": "~2.1|~3.0.0", - "symfony/translation": "~2.2|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0", - "symfony/security": "~2.4|~3.0.0", - "symfony/stopwatch": "~2.2|~3.0.0", - "symfony/console": "~2.4|~3.0.0", - "symfony/var-dumper": "~2.6|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0" + "symfony/finder": "~2.7|~3.0", + "symfony/form": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/locale": "~2.7|~3.0", + "symfony/routing": "~2.7|~3.0", + "symfony/templating": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0", + "symfony/security": "~2.7|~3.0", + "symfony/stopwatch": "~2.7|~3.0", + "symfony/console": "~2.7|~3.0", + "symfony/var-dumper": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0" }, "suggest": { "symfony/finder": "", diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json index 45a463bf8cf11..c5f6ff910ac4d 100644 --- a/src/Symfony/Bundle/DebugBundle/composer.json +++ b/src/Symfony/Bundle/DebugBundle/composer.json @@ -16,14 +16,14 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/http-kernel": "~2.6|~3.0.0", - "symfony/twig-bridge": "~2.6|~3.0.0", - "symfony/var-dumper": "~2.6|~3.0.0" + "php": ">=5.5.9", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/twig-bridge": "~2.7|~3.0", + "symfony/var-dumper": "~2.7|~3.0" }, "require-dev": { - "symfony/config": "~2.3|~3.0.0", - "symfony/dependency-injection": "~2.3|~3.0.0" + "symfony/config": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0" }, "suggest": { "symfony/config": "For service container configuration", diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index e4121069f0d92..bcf474ecda9fe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -16,35 +16,35 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.5.9", "symfony/dependency-injection" : "~2.6,>=2.6.2", "symfony/config" : "~2.4", - "symfony/event-dispatcher": "~2.5|~3.0.0", - "symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4|~3.0.0", - "symfony/http-kernel": "~2.6|~3.0.0", - "symfony/filesystem": "~2.3|~3.0.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/security-core": "~2.6|~3.0.0", - "symfony/security-csrf": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0", - "symfony/templating": "~2.1|~3.0.0", - "symfony/translation": "~2.6|~3.0.0", + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/filesystem": "~2.7|~3.0", + "symfony/routing": "~2.7|~3.0", + "symfony/security-core": "~2.7|~3.0", + "symfony/security-csrf": "~2.7|~3.0", + "symfony/stopwatch": "~2.7|~3.0", + "symfony/templating": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0", "doctrine/annotations": "~1.0" }, "require-dev": { - "symfony/browser-kit": "~2.4|~3.0.0", - "symfony/console": "~2.4,>=2.4.8|~3.0.0", - "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", - "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", - "symfony/finder": "~2.0,>=2.0.5|~3.0.0", - "symfony/locale": "~2.0,>=2.0.5|~3.0.0", - "symfony/security": "~2.6|~3.0.0", - "symfony/form": "~2.6|~3.0.0", - "symfony/class-loader": "~2.1|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/process": "~2.0,>=2.0.5|~3.0.0", - "symfony/validator": "~2.5|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" + "symfony/browser-kit": "~2.7|~3.0", + "symfony/console": "~2.7|~3.0", + "symfony/css-selector": "~2.7|~3.0", + "symfony/dom-crawler": "~2.7|~3.0", + "symfony/finder": "~2.7|~3.0", + "symfony/locale": "~2.7|~3.0", + "symfony/security": "~2.7|~3.0", + "symfony/form": "~2.7|~3.0", + "symfony/class-loader": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", + "symfony/process": "~2.7|~3.0", + "symfony/validator": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0" }, "suggest": { "symfony/console": "For using the console commands", diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 1a6522ba0e7da..f07244f2d21c0 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -16,25 +16,25 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/security": "~2.6|~3.0.0", - "symfony/http-kernel": "~2.2|~3.0.0" + "php": ">=5.5.9", + "symfony/security": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0" }, "require-dev": { - "symfony/browser-kit": "~2.4|~3.0.0", - "symfony/console": "~2.3|~3.0.0", - "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.3|~3.0.0", - "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", - "symfony/form": "~2.4|~3.0.0", - "symfony/framework-bundle": "~2.6|~3.0.0", - "symfony/http-foundation": "~2.3|~3.0.0", - "symfony/twig-bundle": "~2.2|~3.0.0", - "symfony/twig-bridge": "~2.2,>=2.2.6|~3.0.0", - "symfony/process": "~2.0,>=2.0.5|~3.0.0", - "symfony/validator": "~2.5|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", + "symfony/browser-kit": "~2.7|~3.0", + "symfony/console": "~2.7|~3.0", + "symfony/css-selector": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/dom-crawler": "~2.7|~3.0", + "symfony/form": "~2.7|~3.0", + "symfony/framework-bundle": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/twig-bundle": "~2.7|~3.0", + "symfony/twig-bridge": "~2.7|~3.0", + "symfony/process": "~2.7|~3.0", + "symfony/validator": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", "doctrine/doctrine-bundle": "~1.2", "twig/twig": "~1.12" }, diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 5bced5988f4ec..2e95720d40e71 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -16,19 +16,19 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/twig-bridge": "~2.6|~3.0.0", - "symfony/http-foundation": "~2.5|~3.0.0", - "symfony/http-kernel": "~2.1|~3.0.0" + "php": ">=5.5.9", + "symfony/twig-bridge": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0" }, "require-dev": { - "symfony/stopwatch": "~2.2|~3.0.0", - "symfony/dependency-injection": "~2.2|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/config": "~2.2|~3.0.0", - "symfony/routing": "~2.1|~3.0.0", - "symfony/templating": "~2.1|~3.0.0", - "symfony/framework-bundle": "~2.1|~3.0.0" + "symfony/stopwatch": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", + "symfony/config": "~2.7|~3.0", + "symfony/routing": "~2.7|~3.0", + "symfony/templating": "~2.7|~3.0", + "symfony/framework-bundle": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" } diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json index d364af6b14e7b..1cd566f417282 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/composer.json +++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json @@ -16,16 +16,16 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/http-kernel": "~2.4|~3.0.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/twig-bridge": "~2.2|~3.0.0" + "php": ">=5.5.9", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/routing": "~2.7|~3.0", + "symfony/twig-bridge": "~2.7|~3.0" }, "require-dev": { - "symfony/config": "~2.2|~3.0.0", - "symfony/console": "~2.3|~3.0.0", - "symfony/dependency-injection": "~2.2|~3.0.0", - "symfony/stopwatch": "~2.2|~3.0.0" + "symfony/config": "~2.7|~3.0", + "symfony/console": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/stopwatch": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Bundle\\WebProfilerBundle\\": "" } diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json index 922b2af27b208..59146d6b1a14d 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -16,12 +16,12 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0" + "php": ">=5.5.9", + "symfony/dom-crawler": "~2.7|~3.0" }, "require-dev": { - "symfony/process": "~2.0,>=2.0.5|~3.0.0", - "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0" + "symfony/process": "~2.7|~3.0", + "symfony/css-selector": "~2.7|~3.0" }, "suggest": { "symfony/process": "" diff --git a/src/Symfony/Component/ClassLoader/composer.json b/src/Symfony/Component/ClassLoader/composer.json index 8f9456f225e9e..d8cd20757f298 100644 --- a/src/Symfony/Component/ClassLoader/composer.json +++ b/src/Symfony/Component/ClassLoader/composer.json @@ -17,10 +17,10 @@ ], "minimum-stability": "dev", "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/finder": "~2.0,>=2.0.5|~3.0.0" + "symfony/finder": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Component\\ClassLoader\\": "" } diff --git a/src/Symfony/Component/Config/composer.json b/src/Symfony/Component/Config/composer.json index e0688bbc5a8b8..2061297ca075f 100644 --- a/src/Symfony/Component/Config/composer.json +++ b/src/Symfony/Component/Config/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/filesystem": "~2.3|~3.0.0" + "php": ">=5.5.9", + "symfony/filesystem": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Component\\Config\\": "" } diff --git a/src/Symfony/Component/Console/composer.json b/src/Symfony/Component/Console/composer.json index f9b3e4421f708..85b4ed4594a60 100644 --- a/src/Symfony/Component/Console/composer.json +++ b/src/Symfony/Component/Console/composer.json @@ -16,11 +16,11 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0", + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/process": "~2.7|~3.0", "psr/log": "~1.0" }, "suggest": { diff --git a/src/Symfony/Component/CssSelector/composer.json b/src/Symfony/Component/CssSelector/composer.json index 12c782038e913..cc016520ba040 100644 --- a/src/Symfony/Component/CssSelector/composer.json +++ b/src/Symfony/Component/CssSelector/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\CssSelector\\": "" } diff --git a/src/Symfony/Component/Debug/composer.json b/src/Symfony/Component/Debug/composer.json index 73ec28931dfcc..6b52249008ab9 100644 --- a/src/Symfony/Component/Debug/composer.json +++ b/src/Symfony/Component/Debug/composer.json @@ -16,12 +16,12 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.5.9", "psr/log": "~1.0" }, "require-dev": { - "symfony/http-kernel": "~2.2|~3.0.0", - "symfony/http-foundation": "~2.1|~3.0.0" + "symfony/http-kernel": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0" }, "suggest": { "symfony/http-foundation": "", diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index edae1f7ffde95..39c0ea612ed3b 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -16,12 +16,12 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/yaml": "~2.1|~3.0.0", - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0" + "symfony/yaml": "~2.7|~3.0", + "symfony/config": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0" }, "suggest": { "symfony/yaml": "", diff --git a/src/Symfony/Component/DomCrawler/composer.json b/src/Symfony/Component/DomCrawler/composer.json index 3e2a910d9ac1a..d2e57ff6f0a5e 100644 --- a/src/Symfony/Component/DomCrawler/composer.json +++ b/src/Symfony/Component/DomCrawler/composer.json @@ -16,10 +16,10 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/css-selector": "~2.3|~3.0.0" + "symfony/css-selector": "~2.7|~3.0" }, "suggest": { "symfony/css-selector": "" diff --git a/src/Symfony/Component/EventDispatcher/composer.json b/src/Symfony/Component/EventDispatcher/composer.json index 238d8c0de1850..2699e9e0101c3 100644 --- a/src/Symfony/Component/EventDispatcher/composer.json +++ b/src/Symfony/Component/EventDispatcher/composer.json @@ -16,13 +16,13 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", + "symfony/config": "~2.7|~3.0", + "symfony/stopwatch": "~2.7|~3.0", "psr/log": "~1.0" }, "suggest": { diff --git a/src/Symfony/Component/ExpressionLanguage/composer.json b/src/Symfony/Component/ExpressionLanguage/composer.json index 40f241bdcf9c0..dcb6eafc5c807 100644 --- a/src/Symfony/Component/ExpressionLanguage/composer.json +++ b/src/Symfony/Component/ExpressionLanguage/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\ExpressionLanguage\\": "" } diff --git a/src/Symfony/Component/Filesystem/composer.json b/src/Symfony/Component/Filesystem/composer.json index 33d4dd8466c92..baa284321c8d2 100644 --- a/src/Symfony/Component/Filesystem/composer.json +++ b/src/Symfony/Component/Filesystem/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\Filesystem\\": "" } diff --git a/src/Symfony/Component/Finder/composer.json b/src/Symfony/Component/Finder/composer.json index f1edff50204fe..f16da48e45c5b 100644 --- a/src/Symfony/Component/Finder/composer.json +++ b/src/Symfony/Component/Finder/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\Finder\\": "" } diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json index 660118d51dd5f..44ea9b63f9573 100644 --- a/src/Symfony/Component/Form/composer.json +++ b/src/Symfony/Component/Form/composer.json @@ -16,19 +16,19 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/intl": "~2.3|~3.0.0", - "symfony/options-resolver": "~2.1|~3.0.0", - "symfony/property-access": "~2.3|~3.0.0" + "php": ">=5.5.9", + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/intl": "~2.7|~3.0", + "symfony/options-resolver": "~2.7|~3.0", + "symfony/property-access": "~2.7|~3.0" }, "require-dev": { "doctrine/collections": "~1.0", - "symfony/validator": "~2.6|~3.0.0", - "symfony/http-foundation": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.4|~3.0.0", - "symfony/security-csrf": "~2.4|~3.0.0", - "symfony/translation": "~2.0,>=2.0.5|~3.0.0" + "symfony/validator": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0", + "symfony/security-csrf": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0" }, "suggest": { "symfony/validator": "For form validation.", diff --git a/src/Symfony/Component/HttpFoundation/composer.json b/src/Symfony/Component/HttpFoundation/composer.json index 83f120c28799d..12d9acae1ff95 100644 --- a/src/Symfony/Component/HttpFoundation/composer.json +++ b/src/Symfony/Component/HttpFoundation/composer.json @@ -16,10 +16,10 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/expression-language": "~2.4|~3.0.0" + "symfony/expression-language": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Component\\HttpFoundation\\": "" }, diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 426145eb9623a..2790be1058edf 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -16,28 +16,28 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.5.9|~2.6,>=2.6.2|~3.0.0", - "symfony/http-foundation": "~2.5,>=2.5.4|~3.0.0", - "symfony/debug": "~2.6|~3.0.0", + "php": ">=5.5.9", + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/debug": "~2.7|~3.0", "psr/log": "~1.0" }, "require-dev": { - "symfony/browser-kit": "~2.3|~3.0.0", - "symfony/class-loader": "~2.1|~3.0.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/console": "~2.3|~3.0.0", - "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.2|~3.0.0", - "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/finder": "~2.0,>=2.0.5|~3.0.0", - "symfony/process": "~2.0,>=2.0.5|~3.0.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0", - "symfony/templating": "~2.2|~3.0.0", - "symfony/translation": "~2.0,>=2.0.5|~3.0.0", - "symfony/var-dumper": "~2.6|~3.0.0" + "symfony/browser-kit": "~2.7|~3.0", + "symfony/class-loader": "~2.7|~3.0", + "symfony/config": "~2.7|~3.0", + "symfony/console": "~2.7|~3.0", + "symfony/css-selector": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/dom-crawler": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", + "symfony/finder": "~2.7|~3.0", + "symfony/process": "~2.7|~3.0", + "symfony/routing": "~2.7|~3.0", + "symfony/stopwatch": "~2.7|~3.0", + "symfony/templating": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0", + "symfony/var-dumper": "~2.7|~3.0" }, "suggest": { "symfony/browser-kit": "", diff --git a/src/Symfony/Component/Intl/composer.json b/src/Symfony/Component/Intl/composer.json index cae7b626d9b93..97c9cbcdd3022 100644 --- a/src/Symfony/Component/Intl/composer.json +++ b/src/Symfony/Component/Intl/composer.json @@ -24,10 +24,10 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/filesystem": "~2.1|~3.0.0" + "symfony/filesystem": "~2.7|~3.0" }, "suggest": { "ext-intl": "to use the component with locales other than \"en\"" diff --git a/src/Symfony/Component/Locale/composer.json b/src/Symfony/Component/Locale/composer.json index 87e5b08d120d6..e392082383a02 100644 --- a/src/Symfony/Component/Locale/composer.json +++ b/src/Symfony/Component/Locale/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/intl": "~2.3|~3.0.0" + "php": ">=5.5.9", + "symfony/intl": "~2.7|~3.0" }, "autoload": { "psr-0": { "Symfony\\Component\\Locale\\": "" } diff --git a/src/Symfony/Component/OptionsResolver/composer.json b/src/Symfony/Component/OptionsResolver/composer.json index 49a1607a1b7aa..e55aea9d34965 100644 --- a/src/Symfony/Component/OptionsResolver/composer.json +++ b/src/Symfony/Component/OptionsResolver/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\OptionsResolver\\": "" } diff --git a/src/Symfony/Component/Process/composer.json b/src/Symfony/Component/Process/composer.json index 938b3987ab737..6a62b1a7a41c4 100644 --- a/src/Symfony/Component/Process/composer.json +++ b/src/Symfony/Component/Process/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\Process\\": "" } diff --git a/src/Symfony/Component/PropertyAccess/composer.json b/src/Symfony/Component/PropertyAccess/composer.json index 796b736888182..8252b14003963 100644 --- a/src/Symfony/Component/PropertyAccess/composer.json +++ b/src/Symfony/Component/PropertyAccess/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\PropertyAccess\\": "" } diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json index dfb721221307e..038dfaa1b50df 100644 --- a/src/Symfony/Component/Routing/composer.json +++ b/src/Symfony/Component/Routing/composer.json @@ -16,13 +16,13 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/config": "~2.2|~3.0.0", - "symfony/http-foundation": "~2.3|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", + "symfony/config": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0" diff --git a/src/Symfony/Component/Security/Acl/composer.json b/src/Symfony/Component/Security/Acl/composer.json index da751c6360fb1..3a1e904016555 100644 --- a/src/Symfony/Component/Security/Acl/composer.json +++ b/src/Symfony/Component/Security/Acl/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/security-core": "~2.4|~3.0.0" + "php": ">=5.5.9", + "symfony/security-core": "~2.7|~3.0" }, "require-dev": { "doctrine/common": "~2.2", diff --git a/src/Symfony/Component/Security/Core/composer.json b/src/Symfony/Component/Security/Core/composer.json index 15a3a4bab9eb0..018f72a458971 100644 --- a/src/Symfony/Component/Security/Core/composer.json +++ b/src/Symfony/Component/Security/Core/composer.json @@ -16,23 +16,21 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/http-foundation": "~2.4|~3.0.0", - "symfony/translation": "~2.0,>=2.0.5|~3.0.0", - "symfony/validator": "~2.5,>=2.5.5|~3.0.0", - "psr/log": "~1.0", - "ircmaxell/password-compat": "1.0.*" + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0", + "symfony/validator": "~2.7|~3.0", + "psr/log": "~1.0" }, "suggest": { "symfony/event-dispatcher": "", "symfony/http-foundation": "", "symfony/validator": "For using the user password constraint", - "symfony/expression-language": "For using the expression voter", - "ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5" + "symfony/expression-language": "For using the expression voter" }, "autoload": { "psr-0": { "Symfony\\Component\\Security\\Core\\": "" } diff --git a/src/Symfony/Component/Security/Csrf/composer.json b/src/Symfony/Component/Security/Csrf/composer.json index e2cada07a3ff2..805b63e8ef087 100644 --- a/src/Symfony/Component/Security/Csrf/composer.json +++ b/src/Symfony/Component/Security/Csrf/composer.json @@ -16,11 +16,11 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/security-core": "~2.4|~3.0.0" + "php": ">=5.5.9", + "symfony/security-core": "~2.7|~3.0" }, "require-dev": { - "symfony/http-foundation": "~2.1|~3.0.0" + "symfony/http-foundation": "~2.7|~3.0" }, "suggest": { "symfony/http-foundation": "For using the class SessionTokenStorage." diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index 647da05fe1f07..a5cccca1e164f 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -16,15 +16,15 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/security-core": "~2.6|~3.0.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/http-foundation": "~2.4|~3.0.0", - "symfony/http-kernel": "~2.4|~3.0.0" + "php": ">=5.5.9", + "symfony/security-core": "~2.7|~3.0", + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0" }, "require-dev": { - "symfony/routing": "~2.2|~3.0.0", - "symfony/security-csrf": "~2.4|~3.0.0", + "symfony/routing": "~2.7|~3.0", + "symfony/security-csrf": "~2.7|~3.0", "psr/log": "~1.0" }, "suggest": { diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index 556bd11089914..b7b735daa285c 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -16,10 +16,10 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.2|~3.0.0", - "symfony/http-foundation": "~2.1|~3.0.0", - "symfony/http-kernel": "~2.4|~3.0.0" + "php": ">=5.5.9", + "symfony/event-dispatcher": "~2.7|~3.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0" }, "replace": { "symfony/security-acl": "self.version", @@ -28,15 +28,14 @@ "symfony/security-http": "self.version" }, "require-dev": { - "symfony/locale": "~2.0,>=2.0.5|~3.0.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/translation": "~2.0,>=2.0.5|~3.0.0", - "symfony/validator": "~2.5,>=2.5.5|~3.0.0", + "symfony/locale": "~2.7|~3.0", + "symfony/routing": "~2.7|~3.0", + "symfony/translation": "~2.7|~3.0", + "symfony/validator": "~2.7|~3.0", "doctrine/common": "~2.2", "doctrine/dbal": "~2.2", "psr/log": "~1.0", - "ircmaxell/password-compat": "~1.0", - "symfony/expression-language": "~2.6|~3.0.0" + "symfony/expression-language": "~2.7|~3.0" }, "suggest": { "symfony/class-loader": "For using the ACL generateSql script", @@ -44,8 +43,7 @@ "symfony/validator": "For using the user password constraint", "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", "doctrine/dbal": "For using the built-in ACL implementation", - "symfony/expression-language": "For using the expression voter", - "ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5" + "symfony/expression-language": "For using the expression voter" }, "autoload": { "psr-0": { "Symfony\\Component\\Security\\": "" } diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index 4fa968e449ff4..42fa336d27312 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -16,11 +16,11 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/yaml": "~2.0|~3.0.0", - "symfony/config": "~2.2|~3.0.0", + "symfony/yaml": "~2.7|~3.0", + "symfony/config": "~2.7|~3.0", "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0" }, diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json index 99821957ffbbe..de42dde154e6d 100644 --- a/src/Symfony/Component/Stopwatch/composer.json +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\Stopwatch\\": "" } diff --git a/src/Symfony/Component/Templating/composer.json b/src/Symfony/Component/Templating/composer.json index 91defd0602213..8d33006940954 100644 --- a/src/Symfony/Component/Templating/composer.json +++ b/src/Symfony/Component/Templating/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { "psr/log": "~1.0" diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json index cdbe86814a684..d81918f3d43fc 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -16,12 +16,12 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { - "symfony/config": "~2.3,>=2.3.12|~3.0.0", - "symfony/intl": "~2.3|~3.0.0", - "symfony/yaml": "~2.2|~3.0.0", + "symfony/config": "~2.7|~3.0", + "symfony/intl": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0", "psr/log": "~1.0" }, "suggest": { diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index 6160fd0a83695..ed7a20f446eeb 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -16,16 +16,16 @@ } ], "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0,>=2.0.5|~3.0.0" + "php": ">=5.5.9", + "symfony/translation": "~2.7|~3.0" }, "require-dev": { - "symfony/http-foundation": "~2.1|~3.0.0", - "symfony/intl": "~2.3|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0", - "symfony/config": "~2.2|~3.0.0", - "symfony/property-access": "~2.3|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", + "symfony/http-foundation": "~2.7|~3.0", + "symfony/intl": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0", + "symfony/config": "~2.7|~3.0", + "symfony/property-access": "~2.7|~3.0", + "symfony/expression-language": "~2.7|~3.0", "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", "egulias/email-validator": "~1.2,>=1.2.1" diff --git a/src/Symfony/Component/VarDumper/composer.json b/src/Symfony/Component/VarDumper/composer.json index 58560fbcb5426..2c96748f1e64a 100644 --- a/src/Symfony/Component/VarDumper/composer.json +++ b/src/Symfony/Component/VarDumper/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "suggest": { "ext-symfony_debug": "" diff --git a/src/Symfony/Component/Yaml/composer.json b/src/Symfony/Component/Yaml/composer.json index 1ca239845b934..6f63f09a00b27 100644 --- a/src/Symfony/Component/Yaml/composer.json +++ b/src/Symfony/Component/Yaml/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "autoload": { "psr-0": { "Symfony\\Component\\Yaml\\": "" } From 35e0845f237df0ab065c43a7621ce2e5946a08c6 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Nov 2014 21:18:40 +0000 Subject: [PATCH 018/240] [3.0] Removed some old hacks --- README.md | 21 +--- autoload.php.dist | 6 +- ...egacyUniqueEntityValidator2Dot4ApiTest.php | 26 ----- ...gacyUniqueEntityValidatorLegacyApiTest.php | 26 ----- .../Bridge/Twig/Command/LintCommand.php | 4 - .../Bridge/Twig/Extension/CodeExtension.php | 6 +- .../Bridge/Twig/Tests/Node/DumpNodeTest.php | 4 +- .../Bridge/Twig/Tests/Node/FormThemeTest.php | 6 +- .../Node/SearchAndRenderBlockNodeTest.php | 6 +- .../Bridge/Twig/Tests/Node/TransNodeTest.php | 12 +- .../FrameworkBundle/Command/ServerCommand.php | 2 +- .../Command/ServerRunCommand.php | 2 +- .../Command/YamlLintCommand.php | 4 - .../Console/Descriptor/JsonDescriptor.php | 4 - .../DependencyInjection/Configuration.php | 9 +- .../Templating/Helper/CodeHelper.php | 6 +- .../Console/Descriptor/JsonDescriptorTest.php | 7 -- .../DependencyInjection/ConfigurationTest.php | 2 +- .../FrameworkExtensionTest.php | 18 +-- .../SecurityRoutingIntegrationTest.php | 8 -- .../ClassLoader/ClassCollectionLoader.php | 5 +- .../ClassLoader/ClassMapGenerator.php | 10 +- .../ClassLoader/DebugClassLoader.php | 2 +- .../ClassLoader/DebugUniversalClassLoader.php | 2 +- .../Tests/ClassCollectionLoaderTest.php | 18 --- .../Tests/ClassMapGeneratorTest.php | 9 +- .../Console/Descriptor/TextDescriptor.php | 4 - .../Component/Debug/DebugClassLoader.php | 2 +- src/Symfony/Component/Debug/ErrorHandler.php | 43 +------ .../Component/Debug/ExceptionHandler.php | 2 +- .../ClassNotFoundFatalErrorHandler.php | 2 +- src/Symfony/Component/DomCrawler/Crawler.php | 10 +- .../Component/ExpressionLanguage/Parser.php | 4 - .../DateTimeToStringTransformer.php | 9 +- .../Csrf/CsrfProvider/DefaultCsrfProvider.php | 6 +- .../DateTimeToStringTransformerTest.php | 10 +- .../CsrfProvider/DefaultCsrfProviderTest.php | 4 - .../Component/HttpFoundation/JsonResponse.php | 29 +---- .../Storage/Handler/NativeSessionHandler.php | 11 +- .../Session/Storage/NativeSessionStorage.php | 38 +----- .../Storage/PhpBridgeSessionStorage.php | 4 - .../Session/Storage/Proxy/AbstractProxy.php | 32 +---- .../Handler/NativeFileSessionHandlerTest.php | 9 +- .../Handler/NativeSessionHandlerTest.php | 11 +- .../Storage/NativeSessionStorageTest.php | 36 +----- .../Storage/PhpBridgeSessionStorageTest.php | 30 +---- .../Storage/Proxy/AbstractProxyTest.php | 78 +------------ .../Storage/Proxy/SessionHandlerProxyTest.php | 8 +- .../DataCollector/DumpDataCollector.php | 7 +- .../Fragment/HIncludeFragmentRenderer.php | 6 +- .../Controller/ControllerResolverTest.php | 14 +-- .../Data/Bundle/Reader/JsonBundleReader.php | 29 +---- .../Data/Bundle/Writer/JsonBundleWriter.php | 12 +- .../Intl/DateFormatter/IntlDateFormatter.php | 31 ++--- .../Intl/NumberFormatter/NumberFormatter.php | 28 +---- .../Bundle/Writer/JsonBundleWriterTest.php | 8 -- .../AbstractIntlDateFormatterTest.php | 110 ++++-------------- .../DateFormatter/IntlDateFormatterTest.php | 7 +- .../AbstractNumberFormatterTest.php | 24 +--- .../Core/Encoder/BCryptPasswordEncoder.php | 4 - .../Core/Encoder/Pbkdf2PasswordEncoder.php | 26 +---- .../Encoder/BCryptPasswordEncoderTest.php | 11 -- .../Security/Core/Util/SecureRandom.php | 4 +- .../NativeSessionTokenStorageTest.php | 4 - .../NativeSessionTokenStorage.php | 6 +- .../Serializer/Encoder/JsonDecode.php | 6 +- .../Serializer/Encoder/JsonEncoder.php | 19 +-- .../Component/Templating/PhpEngine.php | 16 +-- .../Translation/Dumper/JsonFileDumper.php | 4 - .../Tests/Dumper/JsonFileDumperTest.php | 4 - .../AbstractComparisonValidatorTestCase.php | 4 - .../Constraints/IdenticalToValidatorTest.php | 6 +- .../NotIdenticalToValidatorTest.php | 6 +- .../Tests/Constraints/RangeValidatorTest.php | 20 ++-- .../Validator/LegacyValidator2Dot5ApiTest.php | 9 -- .../LegacyValidatorLegacyApiTest.php | 9 -- .../Validator/Tests/ValidatorBuilderTest.php | 12 +- .../Component/Validator/ValidatorBuilder.php | 13 +-- .../Component/VarDumper/Cloner/VarCloner.php | 2 +- .../VarDumper/Tests/CliDumperTest.php | 2 +- .../VarDumper/Tests/HtmlDumperTest.php | 2 +- .../Yaml/Exception/ParseException.php | 7 +- .../Yaml/Tests/ParseExceptionTest.php | 12 +- 83 files changed, 131 insertions(+), 960 deletions(-) delete mode 100644 src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php delete mode 100644 src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php diff --git a/README.md b/README.md index 42607fbbfa434..ebcbd8664a467 100644 --- a/README.md +++ b/README.md @@ -4,32 +4,13 @@ README What is Symfony? ----------------- -Symfony is a PHP 5.3 full-stack web framework. It is written with speed and +Symfony is a PHP full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP. Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers. -Requirements ------------- - -Symfony is only supported on PHP 5.3.3 and up. - -Be warned that PHP versions before 5.3.8 are known to be buggy and might not -work for you: - - * before PHP 5.3.4, if you get "Notice: Trying to get property of - non-object", you've hit a known PHP bug (see - https://bugs.php.net/bug.php?id=52083 and - https://bugs.php.net/bug.php?id=50027); - - * before PHP 5.3.8, if you get an error involving annotations, you've hit a - known PHP bug (see https://bugs.php.net/bug.php?id=55156). - - * PHP 5.3.16 has a major bug in the Reflection subsystem and is not suitable to - run Symfony (https://bugs.php.net/bug.php?id=62715) - Installation ------------ diff --git a/autoload.php.dist b/autoload.php.dist index c179857248e6b..e2d7299b5ca6d 100644 --- a/autoload.php.dist +++ b/autoload.php.dist @@ -1,8 +1,8 @@ = 50400 && gc_enabled()) { - // Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+ - // https://bugs.php.net/bug.php?id=53976 +// Disabling Zend Garbage Collection to prevent segfaults +// https://bugs.php.net/bug.php?id=53976 +if (gc_enabled()) { gc_disable(); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php deleted file mode 100644 index 3e1151d520b46..0000000000000 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Doctrine\Tests\Validator\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.4 - * @author Bernhard Schussek - */ -class LegacyUniqueEntityValidator2Dot4ApiTest extends UniqueEntityValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php deleted file mode 100644 index 07382d90e9d67..0000000000000 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Doctrine\Tests\Validator\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.4 - * @author Bernhard Schussek - */ -class LegacyUniqueEntityValidatorLegacyApiTest extends UniqueEntityValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index 276b6b96723d2..8f452512609aa 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -11,10 +11,6 @@ namespace Symfony\Bridge\Twig\Command; -if (!defined('JSON_PRETTY_PRINT')) { - define('JSON_PRETTY_PRINT', 128); -} - use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index d7b7898a72be4..3349b4b0c03fb 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -174,11 +174,7 @@ public function formatFile($file, $line, $text = null) $text = "$text at line $line"; if (false !== $link = $this->getFileLink($file, $line)) { - if (PHP_VERSION_ID >= 50400) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } else { - $flags = ENT_QUOTES; - } + $flags = ENT_QUOTES | ENT_SUBSTITUTE; return sprintf('%s', htmlspecialchars($link, $flags, $this->charset), $text); } diff --git a/src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php index 1efe52d126045..e080044c8e3c7 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php @@ -56,7 +56,7 @@ public function testOneVar() } EOTXT; - $expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected); + $expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected); $this->assertSame($expected, $compiler->compile($node)->getSource()); } @@ -82,7 +82,7 @@ public function testMultiVars() } EOTXT; - $expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected); + $expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected); $this->assertSame($expected, $compiler->compile($node)->getSource()); } diff --git a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php index 5f8ae112118fb..34b6de2a526ff 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php @@ -66,10 +66,6 @@ public function testCompile() protected function getVariableGetter($name) { - if (PHP_VERSION_ID >= 50400) { - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } - - return sprintf('$this->getContext($context, "%s")', $name); + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php index 60ef9edfb9751..e08572e60ca4e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php @@ -263,10 +263,6 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes() protected function getVariableGetter($name) { - if (PHP_VERSION_ID >= 50400) { - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } - - return sprintf('$this->getContext($context, "%s")', $name); + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php index df5eb559d8c21..476fc5fef1d7e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php @@ -38,19 +38,11 @@ public function testCompileStrict() } protected function getVariableGetterWithoutStrictCheck($name) { - if (PHP_VERSION_ID >= 50400) { - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } - - return sprintf('$this->getContext($context, "%s", true)', $name); + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); } protected function getVariableGetterWithStrictCheck($name) { - if (PHP_VERSION_ID >= 50400) { - return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name); - } - - return sprintf('$this->getContext($context, "%s")', $name); + return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php index 4a94f99fe091c..cbd5ec892f4a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php @@ -23,7 +23,7 @@ abstract class ServerCommand extends ContainerAwareCommand */ public function isEnabled() { - if (version_compare(phpversion(), '5.4.0', '<') || defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { return false; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 01a1e4da7ffd4..79d4aec6b4194 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -30,7 +30,7 @@ class ServerRunCommand extends ContainerAwareCommand */ public function isEnabled() { - if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) { + if (defined('HHVM_VERSION')) { return false; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php index 967c3b18a317d..83d63f802f5b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php @@ -11,10 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\Command; -if (!defined('JSON_PRETTY_PRINT')) { - define('JSON_PRETTY_PRINT', 128); -} - use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index 5dd2d405ee5c0..2f2f8020dd0b3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -11,10 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; -if (!defined('JSON_PRETTY_PRINT')) { - define('JSON_PRETTY_PRINT', 128); -} - use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 9354a549805a1..d635aae8220bb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -498,14 +498,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode) ->validate() ->ifTrue(function ($v) { return !isset($v['validation']['api']) || 'auto' === $v['validation']['api']; }) ->then(function ($v) { - // This condition is duplicated in ValidatorBuilder. This - // duplication is necessary in order to know the desired - // API version already during container configuration - // (to adjust service classes etc.) - // See https://github.com/symfony/symfony/issues/11580 - $v['validation']['api'] = PHP_VERSION_ID < 50309 - ? '2.4' - : '2.5-bc'; + $v['validation']['api'] = '2.5-bc'; return $v; }) diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index 5ee9fb324dea8..65a4a1a2b5882 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -166,11 +166,7 @@ public function formatFile($file, $line, $text = null) } if (false !== $link = $this->getFileLink($file, $line)) { - if (PHP_VERSION_ID >= 50400) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } else { - $flags = ENT_QUOTES; - } + $flags = ENT_QUOTES | ENT_SUBSTITUTE; return sprintf('%s', htmlspecialchars($link, $flags, $this->charset), $text); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php index 7f7a0ae15cfd7..ee03f65391f8a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php @@ -15,13 +15,6 @@ class JsonDescriptorTest extends AbstractDescriptorTest { - protected function setUp() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped on PHP 5.3 as JSON_PRETTY_PRINT does not exist.'); - } - } - protected function getDescriptor() { return new JsonDescriptor(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 9a4ad2770a442..0fdb592ca69d6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -131,7 +131,7 @@ protected static function getBundleDefaultConfig() 'static_method' => array('loadValidatorMetadata'), 'translation_domain' => 'validators', 'strict_email' => false, - 'api' => PHP_VERSION_ID < 50309 ? '2.4' : '2.5-bc', + 'api' => '2.5-bc', ), 'annotations' => array( 'cache' => 'file', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index acc3cff6ba41e..4c4f14a4fc259 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -295,11 +295,7 @@ public function testValidation() $this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]); $this->assertSame('setApiVersion', $calls[6][0]); - if (PHP_VERSION_ID < 50309) { - $this->assertEquals(array(Validation::API_VERSION_2_4), $calls[6][1]); - } else { - $this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]); - } + $this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]); } public function testFullyConfiguredValidationService() @@ -448,11 +444,7 @@ public function testValidationImplicitApi() $this->assertSame('setApiVersion', $calls[5][0]); // no cache, no annotations - if (PHP_VERSION_ID < 50309) { - $this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]); - } else { - $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]); - } + $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]); } /** @@ -472,11 +464,7 @@ public function testValidationAutoApi() $this->assertSame('setApiVersion', $calls[5][0]); // no cache, no annotations - if (PHP_VERSION_ID < 50309) { - $this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]); - } else { - $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]); - } + $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]); } public function testFormsCanBeEnabledWithoutCsrfProtection() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php index f86ec326afa55..3593b5074314d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php @@ -30,10 +30,6 @@ public function testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous($c */ public function testRoutingErrorIsExposedWhenNotProtected($config) { - if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366'); - } - $client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config)); $client->insulate(); $client->request('GET', '/unprotected_resource'); @@ -46,10 +42,6 @@ public function testRoutingErrorIsExposedWhenNotProtected($config) */ public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config) { - if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366'); - } - $client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config)); $client->insulate(); diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 6bf4ebd545ab3..8627516526d1f 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -43,10 +43,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = self::$loaded[$name] = true; - $declared = array_merge(get_declared_classes(), get_declared_interfaces()); - if (function_exists('get_declared_traits')) { - $declared = array_merge($declared, get_declared_traits()); - } + $declared = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits()); if ($adaptive) { // don't include already declared classes diff --git a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php index 4c2aeab3ac79a..0151751be05b8 100644 --- a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -11,14 +11,6 @@ namespace Symfony\Component\ClassLoader; -if (!defined('SYMFONY_TRAIT')) { - if (PHP_VERSION_ID >= 50400) { - define('SYMFONY_TRAIT', T_TRAIT); - } else { - define('SYMFONY_TRAIT', 0); - } -} - /** * ClassMapGenerator. * @@ -117,7 +109,7 @@ private static function findClasses($path) break; case T_CLASS: case T_INTERFACE: - case SYMFONY_TRAIT: + case T_TRAIT: // Find the classname while (($t = $tokens[++$i]) && is_array($t)) { if (T_STRING === $t[0]) { diff --git a/src/Symfony/Component/ClassLoader/DebugClassLoader.php b/src/Symfony/Component/ClassLoader/DebugClassLoader.php index 897919b20ae21..47bba2d45fe1d 100644 --- a/src/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/src/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -107,7 +107,7 @@ public function loadClass($class) if ($file = $this->classFinder->findFile($class)) { require $file; - if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { + if (!class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) { if (false !== strpos($class, '/')) { throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); } diff --git a/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php b/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php index 678f4e8b2aba6..19bb79fc01a00 100644 --- a/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php +++ b/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php @@ -55,7 +55,7 @@ public function loadClass($class) if ($file = $this->findFile($class)) { require $file; - if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { + if (!class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) { throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); } } diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index e821e45063631..5e5ee06fa7d3c 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -22,12 +22,6 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase { public function testTraitDependencies() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Requires PHP > 5.4'); - - return; - } - require_once __DIR__.'/Fixtures/deps/traits.php'; $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); @@ -100,12 +94,6 @@ public function getDifferentOrders() */ public function testClassWithTraitsReordering(array $classes) { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Requires PHP > 5.4'); - - return; - } - require_once __DIR__.'/Fixtures/ClassesWithParents/ATrait.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/BTrait.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php'; @@ -148,12 +136,6 @@ public function getDifferentOrdersForTraits() public function testFixClassWithTraitsOrdering() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Requires PHP > 5.4'); - - return; - } - require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/F.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/G.php'; diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php index 88099258eccc2..77c861d9eb889 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php @@ -102,18 +102,15 @@ public function getTestCreateMapTests() 'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php', 'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php', )), - ); - - if (PHP_VERSION_ID >= 50400) { - $data[] = array(__DIR__.'/Fixtures/php5.4', array( + array(__DIR__.'/Fixtures/php5.4', array( 'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php', 'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\TBar' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\IBar' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\TFooBar' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\CBar' => __DIR__.'/Fixtures/php5.4/traits.php', - )); - } + )), + ); return $data; } diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php index fcefcd83f68a9..1ed60e1073b4f 100644 --- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php @@ -229,10 +229,6 @@ private function writeText($content, array $options = array()) */ private function formatDefaultValue($default) { - if (PHP_VERSION_ID < 50400) { - return str_replace('\/', '/', json_encode($default)); - } - return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index b70a4c4ac3d24..369e65818c11a 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -162,7 +162,7 @@ public function loadClass($class) ErrorHandler::unstackErrors(); - $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); + $exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); if ('\\' === $class[0]) { $class = substr($class, 1); diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 48e4a2d69e737..65b88a2b3e458 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -357,12 +357,6 @@ public function handleError($type, $message, $file, $line, array $context) $type &= $level | $this->screamedErrors; if ($type && ($log || $throw)) { - if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS']) && ($this->scopedErrors & $type)) { - $e = $context; // Whatever the signature of the method, - unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 - $context = $e; - } - if ($throw) { if (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { // Checking for class existence is a work around for https://bugs.php.net/42098 @@ -371,14 +365,6 @@ public function handleError($type, $message, $file, $line, array $context) $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line); } - if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) { - // Exceptions thrown from error handlers are sometimes not caught by the exception - // handler and shutdown handlers are bypassed before 5.4.8/5.3.18. - // We temporarily re-enable display_errors to prevent any blank page related to this bug. - - $throw->errorHandlerCanary = new ErrorHandlerCanary(); - } - throw $throw; } @@ -401,7 +387,7 @@ public function handleError($type, $message, $file, $line, array $context) $e['stack'] = debug_backtrace(true); // Provide object } } elseif ($trace) { - $e['stack'] = debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false); + $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); } } @@ -658,30 +644,3 @@ public function handleFatal() static::handleFatalError(); } } - -/** - * Private class used to work around https://bugs.php.net/54275 - * - * @author Nicolas Grekas - * - * @internal - */ -class ErrorHandlerCanary -{ - private static $displayErrors = null; - - public function __construct() - { - if (null === self::$displayErrors) { - self::$displayErrors = ini_set('display_errors', 1); - } - } - - public function __destruct() - { - if (null !== self::$displayErrors) { - ini_set('display_errors', self::$displayErrors); - self::$displayErrors = null; - } - } -} diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index cbe582eb24068..56198af0f3faa 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -441,6 +441,6 @@ protected static function utf8Htmlize($str) $str = iconv($charset, 'UTF-8', $str); } - return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8'); + return htmlspecialchars($str, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); } } diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index 0ba0bd4483080..bc5275f3aedd6 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -191,6 +191,6 @@ private function convertFileToClass($path, $file, $prefix) */ private function classExists($class) { - return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); + return class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); } } diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 9471d54a9afce..4f52f218b6710 100755 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -581,15 +581,7 @@ public function html() $html = ''; foreach ($this->getNode(0)->childNodes as $child) { - if (PHP_VERSION_ID >= 50306) { - // node parameter was added to the saveHTML() method in PHP 5.3.6 - // @see http://php.net/manual/en/domdocument.savehtml.php - $html .= $child->ownerDocument->saveHTML($child); - } else { - $document = new \DOMDocument('1.0', 'UTF-8'); - $document->appendChild($document->importNode($child, true)); - $html .= rtrim($document->saveHTML()); - } + $html .= $child->ownerDocument->saveHTML($child); } return $html; diff --git a/src/Symfony/Component/ExpressionLanguage/Parser.php b/src/Symfony/Component/ExpressionLanguage/Parser.php index 3e769c6d4fb24..be884414a2ada 100644 --- a/src/Symfony/Component/ExpressionLanguage/Parser.php +++ b/src/Symfony/Component/ExpressionLanguage/Parser.php @@ -336,10 +336,6 @@ public function parsePostfixExpression($node) $node = new Node\GetAttrNode($node, $arg, $arguments, $type); } elseif ('[' === $token->value) { - if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && PHP_VERSION_ID < 50400) { - throw new SyntaxError('Array calls on a method call is only supported on PHP 5.4+', $token->cursor); - } - $this->stream->next(); $arg = $this->parseExpression(); $this->stream->expect(Token::PUNCTUATION_TYPE, ']'); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php index f5ba9948d0951..45936d51fdb05 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php @@ -61,17 +61,12 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer * * @throws UnexpectedTypeException if a timezone is not a string */ - public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = null) + public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = true) { parent::__construct($inputTimezone, $outputTimezone); $this->generateFormat = $this->parseFormat = $format; - - // The pipe in the parser pattern only works as of PHP 5.3.7 - // See http://bugs.php.net/54316 - $this->parseUsingPipe = null === $parseUsingPipe - ? PHP_VERSION_ID >= 50307 - : $parseUsingPipe; + $this->parseUsingPipe = $parseUsingPipe || null === $parseUsingPipe; // See http://php.net/manual/en/datetime.createfromformat.php // The character "|" in the format makes sure that the parts of a date diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php index fd9110d3b1527..aefc406d7be00 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php @@ -73,11 +73,7 @@ public function isCsrfTokenValid($intention, $token) */ protected function getSessionId() { - if (PHP_VERSION_ID >= 50400) { - if (PHP_SESSION_NONE === session_status()) { - session_start(); - } - } elseif (!session_id()) { + if (PHP_SESSION_NONE === session_status()) { session_start(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php index dbcdad0f96bdf..be0f451a90f9b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php @@ -30,6 +30,7 @@ public function dataProvider() array('H:i:00', '16:05:00', '1970-01-01 16:05:00 UTC'), array('H:i', '16:05', '1970-01-01 16:05:00 UTC'), array('H', '16', '1970-01-01 16:00:00 UTC'), + array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC'), // different day representations array('Y-m-j', '2010-02-3', '2010-02-03 00:00:00 UTC'), @@ -59,11 +60,6 @@ public function dataProvider() array('U', '1265213106', '2010-02-03 16:05:06 UTC'), ); - // This test will fail < 5.3.9 - see https://bugs.php.net/51994 - if (PHP_VERSION_ID >= 50309) { - $data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC'); - } - return $data; } @@ -111,10 +107,6 @@ public function testTransformExpectsDateTime() */ public function testReverseTransformUsingPipe($format, $input, $output) { - if (PHP_VERSION_ID < 50307) { - $this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.'); - } - $reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true); $output = new \DateTime($output); diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php index f201f99862c61..113fc5c6dc3ce 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php @@ -51,10 +51,6 @@ public function testGenerateCsrfTokenOnUnstartedSession() { session_id('touti'); - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('This test requires PHP >= 5.4'); - } - $this->assertSame(PHP_SESSION_NONE, session_status()); $token = $this->provider->generateCsrfToken('foo'); diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index fa80c68858260..a8769db1a58db 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -120,7 +120,7 @@ public function setData($data = array()) } if (JSON_ERROR_NONE !== json_last_error()) { - throw new \InvalidArgumentException($this->transformJsonError()); + throw new \InvalidArgumentException(json_last_error_msg()); } return $this->update(); @@ -172,31 +172,4 @@ protected function update() return $this->setContent($this->data); } - - private function transformJsonError() - { - if (function_exists('json_last_error_msg')) { - return json_last_error_msg(); - } - - switch (json_last_error()) { - case JSON_ERROR_DEPTH: - return 'Maximum stack depth exceeded.'; - - case JSON_ERROR_STATE_MISMATCH: - return 'Underflow or the modes mismatch.'; - - case JSON_ERROR_CTRL_CHAR: - return 'Unexpected control character found.'; - - case JSON_ERROR_SYNTAX: - return 'Syntax error, malformed JSON.'; - - case JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded.'; - - default: - return 'Unknown error.'; - } - } } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php index 80d3ab892dc79..047c70a2d9d5c 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php @@ -16,12 +16,7 @@ * * @see http://php.net/sessionhandler */ -if (PHP_VERSION_ID >= 50400) { - class NativeSessionHandler extends \SessionHandler - { - } -} else { - class NativeSessionHandler - { - } + +class NativeSessionHandler extends \SessionHandler +{ } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index a5bdbe91d8f05..fdb97dcc2c02b 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -101,11 +101,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used) ini_set('session.use_cookies', 1); - if (PHP_VERSION_ID >= 50400) { - session_register_shutdown(); - } else { - register_shutdown_function('session_write_close'); - } + session_register_shutdown(); $this->setMetadataBag($metaBag); $this->setOptions($options); @@ -131,15 +127,10 @@ public function start() return true; } - if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) { + if (\PHP_SESSION_ACTIVE === session_status()) { throw new \RuntimeException('Failed to start the session: already started by PHP.'); } - if (PHP_VERSION_ID < 50400 && !$this->closed && isset($_SESSION) && session_id()) { - // not 100% fool-proof, but is the most reliable way to determine if a session is active in PHP 5.3 - throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).'); - } - if (ini_get('session.use_cookies') && headers_sent($file, $line)) { throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); } @@ -150,10 +141,6 @@ public function start() } $this->loadSession(); - if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { - // This condition matches only PHP 5.3 with internal save handlers - $this->saveHandler->setActive(true); - } return true; } @@ -213,11 +200,6 @@ public function save() { session_write_close(); - if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { - // This condition matches only PHP 5.3 with internal save handlers - $this->saveHandler->setActive(false); - } - $this->closed = true; $this->started = false; } @@ -363,24 +345,12 @@ public function setSaveHandler($saveHandler = null) if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { $saveHandler = new SessionHandlerProxy($saveHandler); } elseif (!$saveHandler instanceof AbstractProxy) { - $saveHandler = PHP_VERSION_ID >= 50400 ? - new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy(); + $saveHandler = new SessionHandlerProxy(new \SessionHandler()); } $this->saveHandler = $saveHandler; if ($this->saveHandler instanceof \SessionHandlerInterface) { - if (PHP_VERSION_ID >= 50400) { - session_set_save_handler($this->saveHandler, false); - } else { - session_set_save_handler( - array($this->saveHandler, 'open'), - array($this->saveHandler, 'close'), - array($this->saveHandler, 'read'), - array($this->saveHandler, 'write'), - array($this->saveHandler, 'destroy'), - array($this->saveHandler, 'gc') - ); - } + session_set_save_handler($this->saveHandler, false); } } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index ced706f72c85b..6f02a7fd73d23 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -43,10 +43,6 @@ public function start() } $this->loadSession(); - if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { - // This condition matches only PHP 5.3 + internal save handlers - $this->saveHandler->setActive(true); - } return true; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 1036818277e1f..f3f14781149c1 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -25,11 +25,6 @@ abstract class AbstractProxy */ protected $wrapper = false; - /** - * @var bool - */ - protected $active = false; - /** * @var string */ @@ -72,32 +67,7 @@ public function isWrapper() */ public function isActive() { - if (PHP_VERSION_ID >= 50400) { - return $this->active = \PHP_SESSION_ACTIVE === session_status(); - } - - return $this->active; - } - - /** - * Sets the active flag. - * - * Has no effect under PHP 5.4+ as status is detected - * automatically in isActive() - * - * @internal - * - * @param bool $flag - * - * @throws \LogicException - */ - public function setActive($flag) - { - if (PHP_VERSION_ID >= 50400) { - throw new \LogicException('This method is disabled in PHP 5.4.0+'); - } - - $this->active = (bool) $flag; + return \PHP_SESSION_ACTIVE === session_status(); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php index ab848b6b972ad..c3eeacf7b117a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -28,13 +28,8 @@ public function testConstruct() { $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); - if (PHP_VERSION_ID < 50400) { - $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('files', ini_get('session.save_handler')); - } else { - $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - } + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('user', ini_get('session.save_handler')); $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path')); $this->assertEquals('TESTING', ini_get('session.name')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php index 3437cf08f1d8d..b2304cbc482da 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php @@ -27,14 +27,7 @@ public function testConstruct() { $handler = new NativeSessionHandler(); - // note for PHPUnit optimisers - the use of assertTrue/False - // here is deliberate since the tests do not require the classes to exist - drak - if (PHP_VERSION_ID < 50400) { - $this->assertFalse($handler instanceof \SessionHandler); - $this->assertTrue($handler instanceof NativeSessionHandler); - } else { - $this->assertTrue($handler instanceof \SessionHandler); - $this->assertTrue($handler instanceof NativeSessionHandler); - } + $this->assertTrue($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 41329e72485e1..9b836bbe99cce 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -165,34 +165,8 @@ public function testSetSaveHandlerException() $storage->setSaveHandler(new \stdClass()); } - public function testSetSaveHandler53() + public function testSetSaveHandler() { - if (PHP_VERSION_ID >= 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); - } - - ini_set('session.save_handler', 'files'); - $storage = $this->getStorage(); - $storage->setSaveHandler(); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(null); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new NativeSessionHandler()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler())); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new NullSessionHandler()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new NativeProxy()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); - } - - public function testSetSaveHandler54() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.4 only.'); - } - ini_set('session.save_handler', 'files'); $storage = $this->getStorage(); $storage->setSaveHandler(); @@ -212,7 +186,7 @@ public function testSetSaveHandler54() /** * @expectedException \RuntimeException */ - public function testStartedOutside() + public function testStarted() { $storage = $this->getStorage(); @@ -222,10 +196,8 @@ public function testStartedOutside() session_start(); $this->assertTrue(isset($_SESSION)); - if (PHP_VERSION_ID >= 50400) { - // this only works in PHP >= 5.4 where session_status is available - $this->assertTrue($storage->getSaveHandler()->isActive()); - } + $this->assertTrue($storage->getSaveHandler()->isActive()); + // PHP session might have started, but the storage driver has not, so false is correct here $this->assertFalse($storage->isStarted()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index d9f4a30a89a68..ed989d40789af 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -59,36 +59,8 @@ protected function getStorage() return $storage; } - public function testPhpSession53() + public function testPhpSession() { - if (PHP_VERSION_ID >= 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); - } - - $storage = $this->getStorage(); - - $this->assertFalse(isset($_SESSION)); - $this->assertFalse($storage->getSaveHandler()->isActive()); - - session_start(); - $this->assertTrue(isset($_SESSION)); - // in PHP 5.3 we cannot reliably tell if a session has started - $this->assertFalse($storage->getSaveHandler()->isActive()); - // PHP session might have started, but the storage driver has not, so false is correct here - $this->assertFalse($storage->isStarted()); - - $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); - $storage->start(); - $this->assertTrue(isset($_SESSION[$key])); - } - - public function testPhpSession54() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.4 only.'); - } - $storage = $this->getStorage(); $this->assertFalse(isset($_SESSION)); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php index ee476a879d0af..7290e62382f9e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php @@ -85,56 +85,18 @@ public function testIsWrapper() $this->assertFalse($this->proxy->isWrapper()); } - public function testIsActivePhp53() - { - if (PHP_VERSION_ID >= 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); - } - - $this->assertFalse($this->proxy->isActive()); - } - /** * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testIsActivePhp54() + public function testIsActive() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.4 only.'); - } $this->assertFalse($this->proxy->isActive()); session_start(); $this->assertTrue($this->proxy->isActive()); } - public function testSetActivePhp53() - { - if (PHP_VERSION_ID >= 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); - } - - $this->proxy->setActive(true); - $this->assertTrue($this->proxy->isActive()); - $this->proxy->setActive(false); - $this->assertFalse($this->proxy->isActive()); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @expectedException \LogicException - */ - public function testSetActivePhp54() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.4 only.'); - } - - $this->proxy->setActive(true); - } - /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -147,30 +109,13 @@ public function testName() $this->assertEquals(session_name(), $this->proxy->getName()); } - /** - * @expectedException \LogicException - */ - public function testNameExceptionPhp53() - { - if (PHP_VERSION_ID >= 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); - } - - $this->proxy->setActive(true); - $this->proxy->setName('foo'); - } - /** * @runInSeparateProcess * @preserveGlobalState disabled * @expectedException \LogicException */ - public function testNameExceptionPhp54() + public function testNameException() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.4 only.'); - } - session_start(); $this->proxy->setName('foo'); } @@ -187,30 +132,13 @@ public function testId() $this->assertEquals(session_id(), $this->proxy->getId()); } - /** - * @expectedException \LogicException - */ - public function testIdExceptionPhp53() - { - if (PHP_VERSION_ID >= 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); - } - - $this->proxy->setActive(true); - $this->proxy->setId('foo'); - } - /** * @runInSeparateProcess * @preserveGlobalState disabled * @expectedException \LogicException */ - public function testIdExceptionPhp54() + public function testIdException() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped, for PHP 5.4 only.'); - } - session_start(); $this->proxy->setId('foo'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index d2775a80a20f1..bc810a6b209b6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -45,7 +45,7 @@ protected function tearDown() $this->proxy = null; } - public function testOpen() + public function testOpenTrue() { $this->mock->expects($this->once()) ->method('open') @@ -53,11 +53,7 @@ public function testOpen() $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); - if (PHP_VERSION_ID < 50400) { - $this->assertTrue($this->proxy->isActive()); - } else { - $this->assertFalse($this->proxy->isActive()); - } + $this->assertFalse($this->proxy->isActive()); } public function testOpenFalse() diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 6099097f366bd..8a836da84c5ab 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -60,12 +60,7 @@ public function dump(Data $data) $this->isCollected = false; } - $trace = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS : true; - if (PHP_VERSION_ID >= 50400) { - $trace = debug_backtrace($trace, 7); - } else { - $trace = debug_backtrace($trace); - } + $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 7); $file = $trace[0]['file']; $line = $trace[0]['line']; diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php index 56c96b3ceda3f..304b527842445 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php @@ -107,11 +107,7 @@ public function render($uri, Request $request, array $options = array()) } $renderedAttributes = ''; if (count($attributes) > 0) { - if (PHP_VERSION_ID >= 50400) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } else { - $flags = ENT_QUOTES; - } + $flags = ENT_QUOTES | ENT_SUBSTITUTE; foreach ($attributes as $attribute => $value) { $renderedAttributes .= sprintf( ' %s="%s"', diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index fe70ae5d5e844..dd1d6242eaa3a 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -181,15 +181,11 @@ public function testGetArguments() $request->attributes->set('foobar', 'foobar'); $controller = array(new self(), 'controllerMethod3'); - if (PHP_VERSION_ID === 50316) { - $this->markTestSkipped('PHP 5.3.16 has a major bug in the Reflection sub-system'); - } else { - try { - $resolver->getArguments($request, $controller); - $this->fail('->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); - } catch (\Exception $e) { - $this->assertInstanceOf('\RuntimeException', $e, '->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); - } + try { + $resolver->getArguments($request, $controller); + $this->fail('->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); + } catch (\Exception $e) { + $this->assertInstanceOf('\RuntimeException', $e, '->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); } $request = Request::create('/'); diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php index 1973843481996..84b20abf77ee8 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php @@ -53,37 +53,10 @@ public function read($path, $locale) 'The resource bundle "%s/%s.json" contains invalid JSON: %s', $path, $locale, - self::getLastJsonError() + json_last_error_msg() )); } return $data; } - - /** - * @return string The last error message created by {@link json_decode()} - * - * @link http://de2.php.net/manual/en/function.json-last-error-msg.php#113243 - */ - private static function getLastJsonError() - { - if (function_exists('json_last_error_msg')) { - return json_last_error_msg(); - } - - static $errors = array( - JSON_ERROR_NONE => null, - JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', - JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', - JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', - JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', - JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', - ); - - $error = json_last_error(); - - return array_key_exists($error, $errors) - ? $errors[$error] - : sprintf('Unknown error (%s)', $error); - } } diff --git a/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php b/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php index 6a79340c695e4..f3df769e13cc6 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php @@ -35,14 +35,8 @@ public function write($path, $locale, $data) } }); - if (PHP_VERSION_ID >= 50400) { - // Use JSON_PRETTY_PRINT so that we can see what changed in Git diffs - file_put_contents( - $path.'/'.$locale.'.json', - json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n" - ); - } else { - file_put_contents($path.'/'.$locale.'.json', json_encode($data)."\n"); - } + $contents = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n"; + + file_put_contents($path.'/'.$locale.'.json', $contents); } } diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php index 7636be9a34975..37bb9cad49771 100644 --- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php +++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php @@ -187,8 +187,7 @@ public static function create($locale, $datetype, $timetype, $timezone = null, $ /** * Format the date/time value (timestamp) as a string. * - * @param int|\DateTime $timestamp The timestamp to format. \DateTime objects - * are supported as of PHP 5.3.4. + * @param int|\DateTime $timestamp The timestamp to format. * * @return string|bool The formatted value or false if formatting failed. * @@ -200,20 +199,16 @@ public function format($timestamp) { // intl allows timestamps to be passed as arrays - we don't if (is_array($timestamp)) { - $message = PHP_VERSION_ID >= 50304 ? - 'Only integer Unix timestamps and DateTime objects are supported' : - 'Only integer Unix timestamps are supported'; + $message = 'Only integer Unix timestamps and DateTime objects are supported'; throw new MethodArgumentValueNotImplementedException(__METHOD__, 'timestamp', $timestamp, $message); } // behave like the intl extension $argumentError = null; - if (PHP_VERSION_ID < 50304 && !is_int($timestamp)) { - $argumentError = 'datefmt_format: takes either an array or an integer timestamp value '; - } elseif (PHP_VERSION_ID >= 50304 && !is_int($timestamp) && !$timestamp instanceof \DateTime) { + if (!is_int($timestamp) && !$timestamp instanceof \DateTime) { $argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object'; - if (PHP_VERSION_ID >= 50500 && !is_int($timestamp)) { + if (!is_int($timestamp)) { $argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp); } } @@ -227,7 +222,7 @@ public function format($timestamp) } // As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances - if (PHP_VERSION_ID >= 50304 && $timestamp instanceof \DateTime) { + if ($timestamp instanceof \DateTime) { $timestamp = $timestamp->getTimestamp(); } @@ -375,10 +370,7 @@ public function getTimeZoneId() return $this->timeZoneId; } - // In PHP 5.5 default timezone depends on `date_default_timezone_get()` method - if (PHP_VERSION_ID >= 50500) { - return date_default_timezone_get(); - } + return date_default_timezone_get(); } /** @@ -540,16 +532,7 @@ public function setPattern($pattern) public function setTimeZoneId($timeZoneId) { if (null === $timeZoneId) { - // In PHP 5.5 if $timeZoneId is null it fallbacks to `date_default_timezone_get()` method - if (PHP_VERSION_ID >= 50500) { - $timeZoneId = date_default_timezone_get(); - } else { - // TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will - // use ini's date.timezone when the time zone is not provided. As a not well tested workaround, uses UTC. - // See the first two items of the commit message for more information: - // https://github.com/php/php-src/commit/eb346ef0f419b90739aadfb6cc7b7436c5b521d9 - $timeZoneId = getenv('TZ') ?: 'UTC'; - } + $timeZoneId = date_default_timezone_get(); $this->unitializedTimeZoneId = true; } diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index 6a66e8bb45d5a..c7f518d74c68a 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -839,9 +839,7 @@ private function getInt32Value($value) * * @param mixed $value The value to be converted * - * @return int|float The converted value - * - * @see https://bugs.php.net/bug.php?id=59597 Bug #59597 + * @return int|false The converted value */ private function getInt64Value($value) { @@ -849,30 +847,6 @@ private function getInt64Value($value) return false; } - if (PHP_INT_SIZE !== 8 && ($value > self::$int32Range['positive'] || $value <= self::$int32Range['negative'])) { - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // The negative PHP_INT_MAX was being converted to float - if ( - $value == self::$int32Range['negative'] && - ((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404) - ) { - return (int) $value; - } - - return (float) $value; - } - - if (PHP_INT_SIZE === 8) { - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // A 32 bit integer was being generated instead of a 64 bit integer - if ( - ($value > self::$int32Range['positive'] || $value < self::$int32Range['negative']) && - (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) - ) { - $value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value)); - } - } - return (int) $value; } diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php index 69575289cdd9f..f2e7b4fce46a5 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php @@ -34,10 +34,6 @@ class JsonBundleWriterTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('This test requires at least PHP 5.4.0.'); - } - $this->writer = new JsonBundleWriter(); $this->directory = sys_get_temp_dir().'/JsonBundleWriterTest/'.rand(1000, 9999); $this->filesystem = new Filesystem(); @@ -47,10 +43,6 @@ protected function setUp() protected function tearDown() { - if (PHP_VERSION_ID < 50400) { - return; - } - $this->filesystem->remove($this->directory); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index 40f5fd71c184a..cbac7ab9f836e 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -37,12 +37,7 @@ public function testConstructorDefaultTimeZone() { $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - // In PHP 5.5 default timezone depends on `date_default_timezone_get()` method - if (PHP_VERSION_ID >= 50500) { - $this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId()); - } else { - $this->assertNull($formatter->getTimeZoneId()); - } + $this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId()); } /** @@ -60,6 +55,8 @@ public function testFormat($pattern, $timestamp, $expected) public function formatProvider() { + $dateTime = new \DateTime('@0'); + $formatData = array( /* general */ array('y-M-d', 0, '1970-1-1'), @@ -236,21 +233,15 @@ public function formatProvider() array('zzz', 0, 'GMT'), array('zzzz', 0, 'GMT'), array('zzzzz', 0, 'GMT'), - ); - - // As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances - if (PHP_VERSION_ID >= 50304) { - $dateTime = new \DateTime('@0'); - - /* general, DateTime */ - $formatData[] = array('y-M-d', $dateTime, '1970-1-1'); - $formatData[] = array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70"); - $formatData[] = array('h:mm a', $dateTime, '12:00 AM'); - $formatData[] = array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM'); - $formatData[] = array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT'); - $formatData[] = array('K:mm a, z', $dateTime, '0:00 AM, GMT'); - } + // general, DateTime + array('y-M-d', $dateTime, '1970-1-1'), + array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70"), + array('h:mm a', $dateTime, '12:00 AM'), + array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM'), + array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT'), + array('K:mm a, z', $dateTime, '0:00 AM, GMT'), + ); return $formatData; } @@ -269,22 +260,8 @@ public function testFormatIllegalArgumentError($pattern, $timestamp, $errorMessa public function formatErrorProvider() { - // With PHP 5.5 IntlDateFormatter accepts empty values ('0') - if (PHP_VERSION_ID >= 50500) { - return array( - array('y-M-d', 'foobar', 'datefmt_format: string \'foobar\' is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR'), - ); - } - - $message = 'datefmt_format: takes either an array or an integer timestamp value : U_ILLEGAL_ARGUMENT_ERROR'; - - if (PHP_VERSION_ID >= 50304) { - $message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR'; - } - return array( - array('y-M-d', '0', $message), - array('y-M-d', 'foobar', $message), + array('y-M-d', 'foobar', 'datefmt_format: string \'foobar\' is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR'), ); } @@ -324,16 +301,12 @@ public function formatWithTimezoneProvider() array(0, 'Europe/Dublin', '1970-01-01 01:00:00'), array(0, 'Europe/Warsaw', '1970-01-01 01:00:00'), array(0, 'Pacific/Fiji', '1970-01-01 12:00:00'), + array(0, 'Foo/Bar', '1970-01-01 00:00:00'), + array(0, 'Foo/Bar', '1970-01-01 00:00:00'), + array(0, 'UTC+04:30', '1970-01-01 00:00:00'), + array(0, 'UTC+04:AA', '1970-01-01 00:00:00'), ); - // As of PHP 5.5, intl ext no longer fallbacks invalid time zones to UTC - if (PHP_VERSION_ID < 50500) { - // When time zone not exists, uses UTC by default - $data[] = array(0, 'Foo/Bar', '1970-01-01 00:00:00'); - $data[] = array(0, 'UTC+04:30', '1970-01-01 00:00:00'); - $data[] = array(0, 'UTC+04:AA', '1970-01-01 00:00:00'); - } - return $data; } @@ -341,11 +314,7 @@ public function testFormatWithGmtTimezone() { $formatter = $this->getDefaultDateFormatter('zzzz'); - if (PHP_VERSION_ID >= 50500) { - $formatter->setTimeZone('GMT+03:00'); - } else { - $formatter->setTimeZoneId('GMT+03:00'); - } + $formatter->setTimeZone('GMT+03:00'); $this->assertEquals('GMT+03:00', $formatter->format(0)); } @@ -354,11 +323,7 @@ public function testFormatWithGmtTimeZoneAndMinutesOffset() { $formatter = $this->getDefaultDateFormatter('zzzz'); - if (PHP_VERSION_ID >= 50500) { - $formatter->setTimeZone('GMT+00:30'); - } else { - $formatter->setTimeZoneId('GMT+00:30'); - } + $formatter->setTimeZone('GMT+00:30'); $this->assertEquals('GMT+00:30', $formatter->format(0)); } @@ -367,11 +332,7 @@ public function testFormatWithNonStandardTimezone() { $formatter = $this->getDefaultDateFormatter('zzzz'); - if (PHP_VERSION_ID >= 50500) { - $formatter->setTimeZone('Pacific/Fiji'); - } else { - $formatter->setTimeZoneId('Pacific/Fiji'); - } + $formatter->setTimeZone('Pacific/Fiji'); $this->assertEquals('Fiji Standard Time', $formatter->format(0)); } @@ -387,35 +348,8 @@ public function testFormatWithConstructorTimezone() ); } - public function testFormatWithTimezoneFromEnvironmentVariable() - { - if (PHP_VERSION_ID >= 50500) { - $this->markTestSkipped('IntlDateFormatter in PHP 5.5 no longer depends on TZ environment.'); - } - - $tz = getenv('TZ'); - putenv('TZ=Europe/London'); - - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); - - $this->assertEquals( - $this->getDateTime(0, 'Europe/London')->format('Y-m-d H:i:s'), - $formatter->format(0) - ); - - $this->assertEquals('Europe/London', getenv('TZ')); - - // Restores TZ. - putenv('TZ='.$tz); - } - public function testFormatWithTimezoneFromPhp() { - if (PHP_VERSION_ID < 50500) { - $this->markTestSkipped('Only in PHP 5.5 IntlDateFormatter depends on default timezone (`date_default_timezone_get()`).'); - } - $tz = date_default_timezone_get(); date_default_timezone_set('Europe/London'); @@ -843,11 +777,7 @@ public function testSetTimeZoneId($timeZoneId, $expectedTimeZoneId) { $formatter = $this->getDefaultDateFormatter(); - if (PHP_VERSION_ID >= 50500) { - $formatter->setTimeZone($timeZoneId); - } else { - $formatter->setTimeZoneId($timeZoneId); - } + $formatter->setTimeZone($timeZoneId); $this->assertEquals($expectedTimeZoneId, $formatter->getTimeZoneId()); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php index 2e7544b39e008..97247d47b540c 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php @@ -56,12 +56,7 @@ public function testFormatWithUnsupportedTimestampArgument() $formatter->format($localtime); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e); - - if (PHP_VERSION_ID >= 50304) { - $this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage()); - } else { - $this->assertStringEndsWith('Only integer Unix timestamps are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage()); - } + $this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage()); } } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 341cdc90c2ad8..531bb4c62b9fa 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -687,13 +687,7 @@ public function testParseTypeInt64With32BitIntegerInPhp32Bit() $parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64); - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // The negative PHP_INT_MAX was being converted to float - if ((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404) { - $this->assertInternalType('int', $parsedValue); - } else { - $this->assertInternalType('float', $parsedValue); - } + $this->assertInternalType('int', $parsedValue); $this->assertEquals(-2147483648, $parsedValue); } @@ -744,24 +738,12 @@ public function testParseTypeInt64With64BitIntegerInPhp64Bit() $parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64); $this->assertInternalType('integer', $parsedValue); - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // A 32 bit integer was being generated instead of a 64 bit integer - if (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) { - $this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); - } else { - $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); - } + $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); $parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64); $this->assertInternalType('integer', $parsedValue); - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // A 32 bit integer was being generated instead of a 64 bit integer - if (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) { - $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); - } else { - $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); - } + $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); } /** diff --git a/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php index d2b031999cbde..c0c8fe0993200 100644 --- a/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php @@ -34,10 +34,6 @@ class BCryptPasswordEncoder extends BasePasswordEncoder */ public function __construct($cost) { - if (!function_exists('password_hash')) { - throw new \RuntimeException('To use the BCrypt encoder, you need to upgrade to PHP 5.5 or install the "ircmaxell/password-compat" via Composer.'); - } - $cost = (int) $cost; if ($cost < 4 || $cost > 31) { throw new \InvalidArgumentException('Cost must be in the range of 4-31.'); diff --git a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php index dac1cad6000ef..8422a4baaea02 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php @@ -64,11 +64,7 @@ public function encodePassword($raw, $salt) throw new \LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm)); } - if (function_exists('hash_pbkdf2')) { - $digest = hash_pbkdf2($this->algorithm, $raw, $salt, $this->iterations, $this->length, true); - } else { - $digest = $this->hashPbkdf2($this->algorithm, $raw, $salt, $this->iterations, $this->length); - } + $digest = hash_pbkdf2($this->algorithm, $raw, $salt, $this->iterations, $this->length, true); return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest); } @@ -80,24 +76,4 @@ public function isPasswordValid($encoded, $raw, $salt) { return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt)); } - - private function hashPbkdf2($algorithm, $password, $salt, $iterations, $length = 0) - { - // Number of blocks needed to create the derived key - $blocks = ceil($length / strlen(hash($algorithm, null, true))); - $digest = ''; - - for ($i = 1; $i <= $blocks; $i++) { - $ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true); - - // Iterations - for ($j = 1; $j < $iterations; $j++) { - $ib ^= ($block = hash_hmac($algorithm, $block, $password, true)); - } - - $digest .= $ib; - } - - return substr($digest, 0, $this->length); - } } diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php index 2f7b845acd158..4d9ca6d48e614 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php @@ -47,8 +47,6 @@ public function testCostInRange() public function testResultLength() { - $this->skipIfPhpVersionIsNotSupported(); - $encoder = new BCryptPasswordEncoder(self::VALID_COST); $result = $encoder->encodePassword(self::PASSWORD, null); $this->assertEquals(60, strlen($result)); @@ -56,21 +54,12 @@ public function testResultLength() public function testValidation() { - $this->skipIfPhpVersionIsNotSupported(); - $encoder = new BCryptPasswordEncoder(self::VALID_COST); $result = $encoder->encodePassword(self::PASSWORD, null); $this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD, null)); $this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null)); } - private function skipIfPhpVersionIsNotSupported() - { - if (PHP_VERSION_ID < 50307) { - $this->markTestSkipped('Requires PHP >= 5.3.7'); - } - } - /** * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException */ diff --git a/src/Symfony/Component/Security/Core/Util/SecureRandom.php b/src/Symfony/Component/Security/Core/Util/SecureRandom.php index aefc88854a648..f4167e4d2f41b 100644 --- a/src/Symfony/Component/Security/Core/Util/SecureRandom.php +++ b/src/Symfony/Component/Security/Core/Util/SecureRandom.php @@ -43,9 +43,7 @@ public function __construct($seedFile = null, LoggerInterface $logger = null) $this->logger = $logger; // determine whether to use OpenSSL - if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50304) { - $this->useOpenSsl = false; - } elseif (!function_exists('openssl_random_pseudo_bytes')) { + if (!function_exists('openssl_random_pseudo_bytes')) { if (null !== $this->logger) { $this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.'); } diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index 0039deb1a857b..ef49f2f884441 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -52,10 +52,6 @@ public function testStoreTokenInClosedSession() public function testStoreTokenInClosedSessionWithExistingSessionId() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('This test requires PHP 5.4 or later.'); - } - session_id('foobar'); $this->assertSame(PHP_SESSION_NONE, session_status()); diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php index 60145c65a05f1..4229bb637bcd2 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php @@ -108,11 +108,7 @@ public function removeToken($tokenId) private function startSession() { - if (PHP_VERSION_ID >= 50400) { - if (PHP_SESSION_NONE === session_status()) { - session_start(); - } - } elseif (!session_id()) { + if (PHP_SESSION_NONE === session_status()) { session_start(); } diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php index 4bb5b43dd0945..a35849a5c65d4 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -99,11 +99,7 @@ public function decode($data, $format, array $context = array()) $recursionDepth = $context['json_decode_recursion_depth']; $options = $context['json_decode_options']; - if (PHP_VERSION_ID >= 50400) { - $decodedData = json_decode($data, $associative, $recursionDepth, $options); - } else { - $decodedData = json_decode($data, $associative, $recursionDepth); - } + $decodedData = json_decode($data, $associative, $recursionDepth, $options); if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { throw new UnexpectedValueException(JsonEncoder::getLastErrorMessage()); diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php index 2231dd624add9..28d619f1f2f23 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php @@ -99,23 +99,6 @@ public function supportsDecoding($format) */ public static function getLastErrorMessage() { - if (function_exists('json_last_error_msg')) { - return json_last_error_msg(); - } - - switch (json_last_error()) { - case JSON_ERROR_DEPTH: - return 'Maximum stack depth exceeded'; - case JSON_ERROR_STATE_MISMATCH: - return 'Underflow or the modes mismatch'; - case JSON_ERROR_CTRL_CHAR: - return 'Unexpected control character found'; - case JSON_ERROR_SYNTAX: - return 'Syntax error, malformed JSON'; - case JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; - default: - return 'Unknown error'; - } + return json_last_error_msg(); } } diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index fd236d2cffd88..491d17c2e0c55 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -457,11 +457,7 @@ public function getGlobals() */ protected function initializeEscapers() { - if (PHP_VERSION_ID >= 50400) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } else { - $flags = ENT_QUOTES; - } + $flags = ENT_QUOTES | ENT_SUBSTITUTE; $this->escapers = array( 'html' => @@ -488,11 +484,11 @@ function ($value) use ($flags) { * @return string the escaped value */ function ($value) { - if ('UTF-8' != $that->getCharset()) { - $value = $that->convertEncoding($value, 'UTF-8', $that->getCharset()); + if ('UTF-8' != $this->getCharset()) { + $value = $this->convertEncoding($value, 'UTF-8', $this->getCharset()); } - $callback = function ($matches) use ($that) { + $callback = function ($matches) { $char = $matches[0]; // \xHH @@ -501,7 +497,7 @@ function ($value) { } // \uHHHH - $char = $that->convertEncoding($char, 'UTF-16BE', 'UTF-8'); + $char = $this->convertEncoding($char, 'UTF-16BE', 'UTF-8'); return '\\u'.substr('0000'.bin2hex($char), -4); }; @@ -511,7 +507,7 @@ function ($value) { } if ('UTF-8' != $this->getCharset()) { - $value = $this->convertEncoding($value, $that->getCharset(), 'UTF-8'); + $value = $this->convertEncoding($value, $this->getCharset(), 'UTF-8'); } return $value; diff --git a/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php b/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php index fea7827498f00..f54321f00ef82 100644 --- a/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php @@ -13,10 +13,6 @@ use Symfony\Component\Translation\MessageCatalogue; -if (!defined('JSON_PRETTY_PRINT')) { - define('JSON_PRETTY_PRINT', 128); -} - /** * JsonFileDumper generates an json formatted string representation of a message catalogue. * diff --git a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php index 697cd939f607a..86594ef8bbdda 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php @@ -18,10 +18,6 @@ class JsonFileDumperTest extends \PHPUnit_Framework_TestCase { public function testDump() { - if (PHP_VERSION_ID < 50400) { - $this->markTestIncomplete('PHP below 5.4 doesn\'t support JSON pretty printing'); - } - $catalogue = new MessageCatalogue('en'); $catalogue->add(array('foo' => 'bar')); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 4013fd48fe0fc..37ce4805f42c5 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -36,10 +36,6 @@ abstract class AbstractComparisonValidatorTestCase extends AbstractConstraintVal { protected static function addPhp5Dot5Comparisons(array $comparisons) { - if (version_compare(PHP_VERSION, '5.5.0-dev', '<')) { - return $comparisons; - } - $result = $comparisons; // Duplicate all tests involving DateTime objects to be tested with diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php index 4b71062f05935..8550e1159fc67 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php @@ -64,10 +64,8 @@ public function provideValidComparisons() array(null, 1), ); - if (version_compare(PHP_VERSION, '>=', '5.5')) { - $immutableDate = new \DateTimeImmutable('2000-01-01'); - $comparisons[] = array($immutableDate, $immutableDate); - } + $immutableDate = new \DateTimeImmutable('2000-01-01'); + $comparisons[] = array($immutableDate, $immutableDate); return $comparisons; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php index 1fbd80663fadd..e59c0945c46cf 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php @@ -82,10 +82,8 @@ public function provideInvalidComparisons() array($object, '2', $object, '2', __NAMESPACE__.'\ComparisonTest_Class'), ); - if (version_compare(PHP_VERSION, '>=', '5.5')) { - $immutableDate = new \DateTimeImmutable('2000-01-01'); - $comparisons[] = array($immutableDate, 'Jan 1, 2000, 12:00 AM', $immutableDate, 'Jan 1, 2000, 12:00 AM', 'DateTime'); - } + $immutableDate = new \DateTimeImmutable('2000-01-01'); + $comparisons[] = array($immutableDate, 'Jan 1, 2000, 12:00 AM', $immutableDate, 'Jan 1, 2000, 12:00 AM', 'DateTime'); return $comparisons; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php index 9b7056b548735..6e6990c39f875 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php @@ -194,11 +194,9 @@ public function getTenthToTwentiethMarch2014() array(new \DateTime('March 20, 2014')), ); - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 10, 2014')); - $tests[] = array(new \DateTimeImmutable('March 15, 2014')); - $tests[] = array(new \DateTimeImmutable('March 20, 2014')); - } + $tests[] = array(new \DateTimeImmutable('March 10, 2014')); + $tests[] = array(new \DateTimeImmutable('March 15, 2014')); + $tests[] = array(new \DateTimeImmutable('March 20, 2014')); $this->restoreDefaultTimezone(); @@ -216,10 +214,8 @@ public function getSoonerThanTenthMarch2014() array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'), ); - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'); - $tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'); - } + $tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'); + $tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'); $this->restoreDefaultTimezone(); @@ -237,10 +233,8 @@ public function getLaterThanTwentiethMarch2014() array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'), ); - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'); - $tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'); - } + $tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'); + $tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'); $this->restoreDefaultTimezone(); diff --git a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php index 3e1e442f75225..4509e22ee191c 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php @@ -19,15 +19,6 @@ class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest { - protected function setUp() - { - if (PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Not supported prior to PHP 5.3.9'); - } - - parent::setUp(); - } - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) { $contextFactory = new LegacyExecutionContextFactory($metadataFactory, new DefaultTranslator()); diff --git a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php index 3f02a5af71c80..3f7bf1e5bb574 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php @@ -19,15 +19,6 @@ class LegacyValidatorLegacyApiTest extends AbstractLegacyApiTest { - protected function setUp() - { - if (PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Not supported prior to PHP 5.3.9'); - } - - parent::setUp(); - } - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) { $contextFactory = new LegacyExecutionContextFactory($metadataFactory, new DefaultTranslator()); diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php index ba184f7c784db..69689d639080f 100644 --- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php +++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php @@ -112,13 +112,7 @@ public function testSetTranslationDomain() public function testDefaultApiVersion() { - if (PHP_VERSION_ID < 50309) { - // Old implementation on PHP < 5.3.9 - $this->assertInstanceOf('Symfony\Component\Validator\Validator', $this->builder->getValidator()); - } else { - // Legacy compatible implementation on PHP >= 5.3.9 - $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); - } + $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); } public function testSetApiVersion24() @@ -135,10 +129,6 @@ public function testSetApiVersion25() public function testSetApiVersion24And25() { - if (PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Not supported prior to PHP 5.3.9'); - } - $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5_BC)); $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); } diff --git a/src/Symfony/Component/Validator/ValidatorBuilder.php b/src/Symfony/Component/Validator/ValidatorBuilder.php index f5cab110cd6ec..8151a444f7938 100644 --- a/src/Symfony/Component/Validator/ValidatorBuilder.php +++ b/src/Symfony/Component/Validator/ValidatorBuilder.php @@ -329,15 +329,6 @@ public function setApiVersion($apiVersion) )); } - if (PHP_VERSION_ID < 50309 && $apiVersion === Validation::API_VERSION_2_5_BC) { - throw new InvalidArgumentException(sprintf( - 'The Validator API that is compatible with both Symfony 2.4 '. - 'and Symfony 2.5 can only be used on PHP 5.3.9 and higher. '. - 'Your current PHP version is %s.', - PHP_VERSION - )); - } - $this->apiVersion = $apiVersion; return $this; @@ -389,9 +380,7 @@ public function getValidator() $apiVersion = $this->apiVersion; if (null === $apiVersion) { - $apiVersion = PHP_VERSION_ID < 50309 - ? Validation::API_VERSION_2_4 - : Validation::API_VERSION_2_5_BC; + $apiVersion = Validation::API_VERSION_2_5_BC; } if (Validation::API_VERSION_2_4 === $apiVersion) { diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 605977be80891..0827bba547ae8 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -266,7 +266,7 @@ private static function initHashMask() } else { // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below $obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'); - foreach (debug_backtrace(PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) { + foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) { $frame['line'] = 0; break; diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index 49710aaa88eae..ed77ccb597ce1 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -38,7 +38,7 @@ public function testGet() ob_start(); $dumper->dump($data); $out = ob_get_clean(); - $closureLabel = PHP_VERSION_ID >= 50400 ? 'public method' : 'function'; + $closureLabel = 'public method'; $out = preg_replace('/[ \t]+$/m', '', $out); $intMax = PHP_INT_MAX; $res1 = (int) $var['res']; diff --git a/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php b/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php index fc8a15f09fa61..87198d6d269d5 100644 --- a/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php @@ -40,7 +40,7 @@ public function testGet() ob_start(); $dumper->dump($data); $out = ob_get_clean(); - $closureLabel = PHP_VERSION_ID >= 50400 ? 'public method' : 'function'; + $closureLabel = 'public method'; $out = preg_replace('/[ \t]+$/m', '', $out); $var['file'] = htmlspecialchars($var['file'], ENT_QUOTES, 'UTF-8'); $intMax = PHP_INT_MAX; diff --git a/src/Symfony/Component/Yaml/Exception/ParseException.php b/src/Symfony/Component/Yaml/Exception/ParseException.php index 0447dff137345..180e712e90f80 100644 --- a/src/Symfony/Component/Yaml/Exception/ParseException.php +++ b/src/Symfony/Component/Yaml/Exception/ParseException.php @@ -125,12 +125,7 @@ private function updateRepr() } if (null !== $this->parsedFile) { - if (PHP_VERSION_ID >= 50400) { - $jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; - } else { - $jsonOptions = 0; - } - $this->message .= sprintf(' in %s', json_encode($this->parsedFile, $jsonOptions)); + $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); } if ($this->parsedLine >= 0) { diff --git a/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php b/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php index e4eb9c98a15d1..7286d45a0939b 100644 --- a/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php @@ -18,11 +18,7 @@ class ParseExceptionTest extends \PHPUnit_Framework_TestCase public function testGetMessage() { $exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml'); - if (PHP_VERSION_ID >= 50400) { - $message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")'; - } else { - $message = 'Error message in "\\/var\\/www\\/app\\/config.yml" at line 42 (near "foo: bar")'; - } + $message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")'; $this->assertEquals($message, $exception->getMessage()); } @@ -30,11 +26,7 @@ public function testGetMessage() public function testGetMessageWithUnicodeInFilename() { $exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml'); - if (PHP_VERSION_ID >= 50400) { - $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")'; - } else { - $message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")'; - } + $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")'; $this->assertEquals($message, $exception->getMessage()); } From 2221a150feef7e6dee295004d0bf30498423cc15 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Tue, 30 Dec 2014 16:16:25 +0100 Subject: [PATCH 019/240] [3.0] [Twig Bridge] Fixed Tests --- .../Extension/FormExtensionDivLayoutTest.php | 19 ++++++++++------- .../FormExtensionTableLayoutTest.php | 12 ++++++++++- .../Templating/Helper/FormHelper.php | 21 ------------------- .../Helper/FormHelperDivLayoutTest.php | 18 ++++++++++++---- .../Helper/FormHelperTableLayoutTest.php | 18 ++++++++++++---- .../Form/Tests/AbstractLayoutTest.php | 20 ------------------ 6 files changed, 50 insertions(+), 58 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php index 4b347fe2efe0e..f621db6e83bd7 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php @@ -106,17 +106,10 @@ public function testThemeBlockInheritanceUsingDynamicExtend() public function isSelectedChoiceProvider() { - // The commented cases should not be necessary anymore, because the - // choice lists should assure that both values passed here are always - // strings return array( -// array(true, 0, 0), array(true, '0', '0'), array(true, '1', '1'), -// array(true, false, 0), -// array(true, true, 1), array(true, '', ''), -// array(true, null, ''), array(true, '1.23', '1.23'), array(true, 'foo', 'foo'), array(true, 'foo10', 'foo10'), @@ -144,7 +137,7 @@ protected function renderForm(FormView $view, array $vars = array()) protected function renderEnctype(FormView $view) { - return (string) $this->extension->renderer->searchAndRenderBlock($view, 'enctype'); + // Kept empty for 2.7 compatibility } protected function renderLabel(FormView $view, $label = null, array $vars = array()) @@ -204,4 +197,14 @@ public static function themeInheritanceProvider() array(array('parent_label.html.twig'), array('child_label.html.twig')), ); } + + public function testEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } + + public function testNoEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php index b5a08e47a57dd..90d26cbc5146b 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php @@ -66,7 +66,7 @@ protected function renderForm(FormView $view, array $vars = array()) protected function renderEnctype(FormView $view) { - return (string) $this->extension->renderer->searchAndRenderBlock($view, 'enctype'); + // Kept empty for 2.7 compatibility } protected function renderLabel(FormView $view, $label = null, array $vars = array()) @@ -112,4 +112,14 @@ protected function setTheme(FormView $view, array $themes) { $this->extension->renderer->setTheme($view, $themes); } + + public function testEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } + + public function testNoEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index 0915a068b6303..2bd2336ee5919 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -120,27 +120,6 @@ public function end(FormView $view, array $variables = array()) return $this->renderer->renderBlock($view, 'form_end', $variables); } - /** - * Renders the HTML enctype in the form tag, if necessary. - * - * Example usage templates: - * - *
    enctype($form) ?>> - * - * @param FormView $view The view for which to render the encoding type - * - * @return string The HTML markup - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use - * {@link start} instead. - */ - public function enctype(FormView $view) - { - trigger_error('The form helper $view[\'form\']->enctype() is deprecated since version 2.3 and will be removed in 3.0. Use $view[\'form\']->start() instead.', E_USER_DEPRECATED); - - return $this->renderer->searchAndRenderBlock($view, 'enctype'); - } - /** * Renders the HTML for a given view. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php index 2fbff686fc07c..cbade328d268d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php @@ -57,14 +57,14 @@ protected function tearDown() parent::tearDown(); } - protected function renderForm(FormView $view, array $vars = array()) + protected function renderEnctype(FormView $view) { - return (string) $this->engine->get('form')->form($view, $vars); + // Kept empty for 2.7 compatibility } - protected function renderEnctype(FormView $view) + protected function renderForm(FormView $view, array $vars = array()) { - return (string) $this->engine->get('form')->enctype($view); + return (string) $this->engine->get('form')->form($view, $vars); } protected function renderLabel(FormView $view, $label = null, array $vars = array()) @@ -120,4 +120,14 @@ public static function themeInheritanceProvider() array(array('TestBundle:Parent'), array('TestBundle:Child')), ); } + + public function testEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } + + public function testNoEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php index c95442bed61f8..c7a7168985c44 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php @@ -58,14 +58,14 @@ protected function tearDown() parent::tearDown(); } - protected function renderForm(FormView $view, array $vars = array()) + protected function renderEnctype(FormView $view) { - return (string) $this->engine->get('form')->form($view, $vars); + // Kept empty for 2.7 compatibility } - protected function renderEnctype(FormView $view) + protected function renderForm(FormView $view, array $vars = array()) { - return (string) $this->engine->get('form')->enctype($view); + return (string) $this->engine->get('form')->form($view, $vars); } protected function renderLabel(FormView $view, $label = null, array $vars = array()) @@ -107,4 +107,14 @@ protected function setTheme(FormView $view, array $themes) { $this->engine->get('form')->setTheme($view, $themes); } + + public function testEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } + + public function testNoEnctype() + { + $this->markTestSkipped('This test is skipped to keep 2.7 compatibility.'); + } } diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 33177e1fbd2fc..c234d537bd654 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -101,8 +101,6 @@ protected function assertWidgetMatchesXpath(FormView $view, array $vars, $xpath) abstract protected function renderForm(FormView $view, array $vars = array()); - abstract protected function renderEnctype(FormView $view); - abstract protected function renderLabel(FormView $view, $label = null, array $vars = array()); abstract protected function renderErrors(FormView $view); @@ -119,24 +117,6 @@ abstract protected function renderEnd(FormView $view, array $vars = array()); abstract protected function setTheme(FormView $view, array $themes); - public function testEnctype() - { - $form = $this->factory->createNamedBuilder('name', 'form') - ->add('file', 'file') - ->getForm(); - - $this->assertEquals('enctype="multipart/form-data"', $this->renderEnctype($form->createView())); - } - - public function testNoEnctype() - { - $form = $this->factory->createNamedBuilder('name', 'form') - ->add('text', 'text') - ->getForm(); - - $this->assertEquals('', $this->renderEnctype($form->createView())); - } - public function testLabel() { $form = $this->factory->createNamed('name', 'text'); From 2120554141e2b6e8d6af4699b620ce7eb70d89e5 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Wed, 12 Nov 2014 00:39:57 +0100 Subject: [PATCH 020/240] Removed request service occurrences. --- .../FrameworkBundle/Controller/Controller.php | 16 ---------------- .../Resources/config/services.xml | 13 +------------ .../Resources/config/templating_php.xml | 7 +++---- .../Form/UserLoginFormType.php | 19 ++++++++----------- .../Functional/app/CsrfFormLogin/config.yml | 4 +--- 5 files changed, 13 insertions(+), 46 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index f42d134e295eb..beb25698b967d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -261,22 +261,6 @@ public function createFormBuilder($data = null, array $options = array()) return $this->container->get('form.factory')->createBuilder('form', $data, $options); } - /** - * Shortcut to return the request service. - * - * @return Request - * - * @deprecated Deprecated since version 2.4, to be removed in 3.0. Ask - * Symfony to inject the Request object into your controller - * method instead by type hinting it in the method's signature. - */ - public function getRequest() - { - trigger_error('The "getRequest" method of the base "Controller" class has been deprecated since Symfony 2.4 and will be removed in 3.0. The only reliable way to get the "Request" object is to inject it in the action method.', E_USER_DEPRECATED); - - return $this->container->get('request_stack')->getCurrentRequest(); - } - /** * Shortcut to return the Doctrine Registry service. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml index 4457dbb27669c..2c3c6ea312a62 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml @@ -37,22 +37,11 @@ - - - - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml index 6e482f8573e51..7cfcc0986324b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml @@ -44,7 +44,7 @@ - + service('request_stack').getMasterRequest() @@ -55,9 +55,8 @@ - - - + + service('request_stack').getMasterRequest() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php index 6928e6868b09c..c615ef5fd6106 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php @@ -16,7 +16,7 @@ use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; -use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Security\Core\Security; @@ -29,18 +29,15 @@ */ class UserLoginFormType extends AbstractType { - private $request; + private $requestStack; - /** - * @param Request $request A request instance - */ - public function __construct(Request $request) + public function __construct(RequestStack $requestStack) { - $this->request = $request; + $this->requestStack = $requestStack; } /** - * @see Symfony\Component\Form\AbstractType::buildForm() + * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { @@ -50,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('_target_path', 'hidden') ; - $request = $this->request; + $request = $this->requestStack->getCurrentRequest(); /* Note: since the Security component's form login listener intercepts * the POST request, this form will never really be bound to the @@ -75,7 +72,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @see Symfony\Component\Form\AbstractType::setDefaultOptions() + * {@inheritdoc} */ public function setDefaultOptions(OptionsResolverInterface $resolver) { @@ -89,7 +86,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) } /** - * @see Symfony\Component\Form\FormTypeInterface::getName() + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml index e1e2b0e883933..8b0920df37202 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml @@ -4,9 +4,7 @@ imports: services: csrf_form_login.form.type: class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType - scope: request - arguments: - - @request + arguments: [ @request_stack ] tags: - { name: form.type, alias: user_login } From 4391219d33f0aae8437d8fd58d39d903eb24181a Mon Sep 17 00:00:00 2001 From: Saro0h Date: Sat, 3 Jan 2015 14:15:49 +0100 Subject: [PATCH 021/240] Fixed tests --- .../Tests/Controller/ControllerTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php index 6ff09c348ceb0..13751bc711684 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php @@ -37,10 +37,18 @@ public function testForward() $container->expects($this->at(0))->method('get')->will($this->returnValue($requestStack)); $container->expects($this->at(1))->method('get')->will($this->returnValue($kernel)); - $controller = new Controller(); + $controller = new TestController(); $controller->setContainer($container); $response = $controller->forward('a_controller'); $this->assertEquals('xml--fr', $response->getContent()); } } + +class TestController extends Controller +{ + public function forward($controller, array $path = array(), array $query = array()) + { + return parent::forward($controller, $path, $query); + } +} From a333811d041bacdf7b603f6f6a525c67c78157c7 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Sat, 3 Jan 2015 12:33:20 +0100 Subject: [PATCH 022/240] [Config] removed deprecated ReferenceDumper class. --- src/Symfony/Component/Config/CHANGELOG.md | 11 +++++++--- .../Config/Definition/ReferenceDumper.php | 21 ------------------- 2 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 src/Symfony/Component/Config/Definition/ReferenceDumper.php diff --git a/src/Symfony/Component/Config/CHANGELOG.md b/src/Symfony/Component/Config/CHANGELOG.md index 59b30a3a7a6d8..1ca1c492e2d50 100644 --- a/src/Symfony/Component/Config/CHANGELOG.md +++ b/src/Symfony/Component/Config/CHANGELOG.md @@ -1,15 +1,20 @@ CHANGELOG ========= +3.0.0 +----- + + * removed `ReferenceDumper` class + 2.2.0 ----- - * added ArrayNodeDefinition::canBeEnabled() and ArrayNodeDefinition::canBeDisabled() + * added `ArrayNodeDefinition::canBeEnabled()` and `ArrayNodeDefinition::canBeDisabled()` to ease configuration when some sections are respectively disabled / enabled by default. * added a `normalizeKeys()` method for array nodes (to avoid key normalization) * added numerical type handling for config definitions - * added convenience methods for optional configuration sections to ArrayNodeDefinition + * added convenience methods for optional configuration sections to `ArrayNodeDefinition` * added a utils class for XML manipulations 2.1.0 @@ -17,5 +22,5 @@ CHANGELOG * added a way to add documentation on configuration * implemented `Serializable` on resources - * LoaderResolverInterface is now used instead of LoaderResolver for type + * `LoaderResolverInterface` is now used instead of `LoaderResolver` for type hinting diff --git a/src/Symfony/Component/Config/Definition/ReferenceDumper.php b/src/Symfony/Component/Config/Definition/ReferenceDumper.php deleted file mode 100644 index 7fe336d8fbf11..0000000000000 --- a/src/Symfony/Component/Config/Definition/ReferenceDumper.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper; - -/** - * @deprecated Deprecated since version 2.4, to be removed in 3.0. Use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper instead. - */ -class ReferenceDumper extends YamlReferenceDumper -{ -} From 1cdb655b115748975b802bc57973d080a40a67b4 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Fri, 26 Dec 2014 01:42:48 +0100 Subject: [PATCH 023/240] [Form] Removed depracted events PRE_BIND, BIND and POST_BIND --- .../Component/Form/Deprecated/FormEvents.php | 28 -- .../EventListener/BindRequestListener.php | 84 ------ .../Type/FormTypeHttpFoundationExtension.php | 8 - src/Symfony/Component/Form/FormEvents.php | 26 -- .../LegacyBindRequestListenerTest.php | 255 ------------------ .../Component/Form/Tests/SimpleFormTest.php | 8 +- 6 files changed, 4 insertions(+), 405 deletions(-) delete mode 100644 src/Symfony/Component/Form/Deprecated/FormEvents.php delete mode 100644 src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php delete mode 100644 src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/LegacyBindRequestListenerTest.php diff --git a/src/Symfony/Component/Form/Deprecated/FormEvents.php b/src/Symfony/Component/Form/Deprecated/FormEvents.php deleted file mode 100644 index 862879e75a610..0000000000000 --- a/src/Symfony/Component/Form/Deprecated/FormEvents.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Deprecated; - -trigger_error('Constants PRE_BIND, BIND and POST_BIND on class Symfony\Component\Form\FormEvents were deprecated in Symfony 2.3 and will be removed in 3.0. Use PRE_SUBMIT, SUBMIT and POST_SUBMIT instead.', E_USER_DEPRECATED); - -/** - * @deprecated since 2.7, to be removed in 3.0. - * @internal - */ -final class FormEvents -{ - const PRE_BIND = 'form.pre_bind'; - const BIND = 'form.bind'; - const POST_BIND = 'form.post_bind'; - - private function __construct() - { - } -} diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php b/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php deleted file mode 100644 index bb144ed65ad6e..0000000000000 --- a/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Extension\HttpFoundation\EventListener; - -use Symfony\Component\Form\FormEvents; -use Symfony\Component\Form\FormEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Pass the - * Request instance to {@link Form::handleRequest()} instead. - */ -class BindRequestListener implements EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - // High priority in order to supersede other listeners - return array(FormEvents::PRE_SUBMIT => array('preBind', 128)); - } - - public function preBind(FormEvent $event) - { - $form = $event->getForm(); - - /* @var Request $request */ - $request = $event->getData(); - - // Only proceed if we actually deal with a Request - if (!$request instanceof Request) { - return; - } - - // Uncomment this as soon as the deprecation note should be shown - // trigger_error('Passing a Request instance to Form::submit() is deprecated since version 2.3 and will be disabled in 3.0. Call Form::process($request) instead.', E_USER_DEPRECATED); - - $name = $form->getConfig()->getName(); - $default = $form->getConfig()->getCompound() ? array() : null; - - // For request methods that must not have a request body we fetch data - // from the query string. Otherwise we look for data in the request body. - switch ($request->getMethod()) { - case 'GET': - case 'HEAD': - case 'TRACE': - $data = '' === $name - ? $request->query->all() - : $request->query->get($name, $default); - - break; - - default: - if ('' === $name) { - // Form bound without name - $params = $request->request->all(); - $files = $request->files->all(); - } else { - $params = $request->request->get($name, $default); - $files = $request->files->get($name, $default); - } - - if (is_array($params) && is_array($files)) { - $data = array_replace_recursive($params, $files); - } else { - $data = $params ?: $files; - } - - break; - } - - $event->setData($data); - } -} diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php index 9cb0dc4476c59..a3bd84372880b 100644 --- a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php +++ b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Extension\HttpFoundation\Type; use Symfony\Component\Form\AbstractTypeExtension; -use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener; use Symfony\Component\Form\RequestHandlerInterface; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler; @@ -22,11 +21,6 @@ */ class FormTypeHttpFoundationExtension extends AbstractTypeExtension { - /** - * @var BindRequestListener - */ - private $listener; - /** * @var RequestHandlerInterface */ @@ -37,7 +31,6 @@ class FormTypeHttpFoundationExtension extends AbstractTypeExtension */ public function __construct(RequestHandlerInterface $requestHandler = null) { - $this->listener = new BindRequestListener(); $this->requestHandler = $requestHandler ?: new HttpFoundationRequestHandler(); } @@ -46,7 +39,6 @@ public function __construct(RequestHandlerInterface $requestHandler = null) */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->addEventSubscriber($this->listener); $builder->setRequestHandler($this->requestHandler); } diff --git a/src/Symfony/Component/Form/FormEvents.php b/src/Symfony/Component/Form/FormEvents.php index 317472c8a00a4..33597525f7b8a 100644 --- a/src/Symfony/Component/Form/FormEvents.php +++ b/src/Symfony/Component/Form/FormEvents.php @@ -10,8 +10,6 @@ namespace Symfony\Component\Form; -use Symfony\Component\Form\Deprecated\FormEvents as Deprecated; - /** * @author Bernhard Schussek */ @@ -73,30 +71,6 @@ final class FormEvents */ const POST_SET_DATA = 'form.post_set_data'; - /** - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use - * {@link PRE_SUBMIT} instead. - * - * @Event - */ - const PRE_BIND = Deprecated::PRE_BIND; - - /** - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use - * {@link SUBMIT} instead. - * - * @Event - */ - const BIND = Deprecated::BIND; - - /** - * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use - * {@link POST_SUBMIT} instead. - * - * @Event - */ - const POST_BIND = Deprecated::POST_BIND; - private function __construct() { } diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/LegacyBindRequestListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/LegacyBindRequestListenerTest.php deleted file mode 100644 index 183d3a7a3a975..0000000000000 --- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/LegacyBindRequestListenerTest.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Tests\Extension\HttpFoundation\EventListener; - -use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener; -use Symfony\Component\Form\Form; -use Symfony\Component\Form\FormConfigBuilder; -use Symfony\Component\Form\FormEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\File\UploadedFile; - -/** - * @author Bernhard Schussek - */ -class LegacyBindRequestListenerTest extends \PHPUnit_Framework_TestCase -{ - private $values; - - private $filesPlain; - - private $filesNested; - - /** - * @var UploadedFile - */ - private $uploadedFile; - - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $path = tempnam(sys_get_temp_dir(), 'sf2'); - touch($path); - - $this->values = array( - 'name' => 'Bernhard', - 'image' => array('filename' => 'foobar.png'), - ); - - $this->filesPlain = array( - 'image' => array( - 'error' => UPLOAD_ERR_OK, - 'name' => 'upload.png', - 'size' => 123, - 'tmp_name' => $path, - 'type' => 'image/png', - ), - ); - - $this->filesNested = array( - 'error' => array('image' => UPLOAD_ERR_OK), - 'name' => array('image' => 'upload.png'), - 'size' => array('image' => 123), - 'tmp_name' => array('image' => $path), - 'type' => array('image' => 'image/png'), - ); - - $this->uploadedFile = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); - } - - protected function tearDown() - { - unlink($this->uploadedFile->getRealPath()); - } - - public function requestMethodProvider() - { - return array( - array('POST'), - array('PUT'), - array('DELETE'), - array('PATCH'), - ); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testSubmitRequest($method) - { - $values = array('author' => $this->values); - $files = array('author' => $this->filesNested); - $request = new Request(array(), $values, array(), array(), $files, array( - 'REQUEST_METHOD' => $method, - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('author', null, $dispatcher); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - $this->assertEquals(array( - 'name' => 'Bernhard', - 'image' => $this->uploadedFile, - ), $event->getData()); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testSubmitRequestWithEmptyName($method) - { - $request = new Request(array(), $this->values, array(), array(), $this->filesPlain, array( - 'REQUEST_METHOD' => $method, - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('', null, $dispatcher); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - $this->assertEquals(array( - 'name' => 'Bernhard', - 'image' => $this->uploadedFile, - ), $event->getData()); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testSubmitEmptyRequestToCompoundForm($method) - { - $request = new Request(array(), array(), array(), array(), array(), array( - 'REQUEST_METHOD' => $method, - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('author', null, $dispatcher); - $config->setCompound(true); - $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface')); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - // Default to empty array - $this->assertEquals(array(), $event->getData()); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testSubmitEmptyRequestToSimpleForm($method) - { - $request = new Request(array(), array(), array(), array(), array(), array( - 'REQUEST_METHOD' => $method, - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('author', null, $dispatcher); - $config->setCompound(false); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - // Default to null - $this->assertNull($event->getData()); - } - - public function testSubmitGetRequest() - { - $values = array('author' => $this->values); - $request = new Request($values, array(), array(), array(), array(), array( - 'REQUEST_METHOD' => 'GET', - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('author', null, $dispatcher); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - $this->assertEquals(array( - 'name' => 'Bernhard', - 'image' => array('filename' => 'foobar.png'), - ), $event->getData()); - } - - public function testSubmitGetRequestWithEmptyName() - { - $request = new Request($this->values, array(), array(), array(), array(), array( - 'REQUEST_METHOD' => 'GET', - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('', null, $dispatcher); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - $this->assertEquals(array( - 'name' => 'Bernhard', - 'image' => array('filename' => 'foobar.png'), - ), $event->getData()); - } - - public function testSubmitEmptyGetRequestToCompoundForm() - { - $request = new Request(array(), array(), array(), array(), array(), array( - 'REQUEST_METHOD' => 'GET', - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('author', null, $dispatcher); - $config->setCompound(true); - $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface')); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - $this->assertEquals(array(), $event->getData()); - } - - public function testSubmitEmptyGetRequestToSimpleForm() - { - $request = new Request(array(), array(), array(), array(), array(), array( - 'REQUEST_METHOD' => 'GET', - )); - - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfigBuilder('author', null, $dispatcher); - $config->setCompound(false); - $form = new Form($config); - $event = new FormEvent($form, $request); - - $listener = new BindRequestListener(); - $listener->preBind($event); - - $this->assertNull($event->getData()); - } -} diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 69e75c94ca263..367f115304e62 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -122,19 +122,19 @@ public function testDataIsInitializedFromSubmit() public function testFalseIsConvertedToNull() { $mock = $this->getMockBuilder('\stdClass') - ->setMethods(array('preBind')) + ->setMethods(array('preSubmit')) ->getMock(); $mock->expects($this->once()) - ->method('preBind') + ->method('preSubmit') ->with($this->callback(function ($event) { return null === $event->getData(); })); $config = new FormConfigBuilder('name', null, $this->dispatcher); - $config->addEventListener(FormEvents::PRE_SUBMIT, array($mock, 'preBind')); + $config->addEventListener(FormEvents::PRE_SUBMIT, array($mock, 'preSubmit')); $form = new Form($config); - $form->submit(false); + $form->bind(false); $this->assertTrue($form->isValid()); $this->assertNull($form->getData()); From 1b2501820842c11416c672fc386a1fcff9ace808 Mon Sep 17 00:00:00 2001 From: Saro0h Date: Tue, 6 Jan 2015 09:39:50 +0100 Subject: [PATCH 024/240] [FrameworkBundle] Fixed TextDescriptor::describeEventDispatcherListeners() --- .../FrameworkBundle/Console/Descriptor/TextDescriptor.php | 5 +++-- .../Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 88ad0ea3bc96f..fea7962550684 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -310,6 +310,8 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev foreach ($registeredListeners as $order => $listener) { $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener))); } + + $table->render(); } else { ksort($registeredListeners); foreach ($registeredListeners as $eventListened => $eventListeners) { @@ -320,10 +322,9 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev foreach ($eventListeners as $order => $eventListener) { $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener))); } + $table->render(); } } - - $table->render(); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt index 4cd880b0ef9f4..a07176b593a43 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/event_dispatcher_1_events.txt @@ -1,6 +1,12 @@ [event_dispatcher] Registered listeners by event [Event] event1 ++-------+-------------------+ +| Order | Callable | ++-------+-------------------+ +| #1 | global_function() | +| #2 | \Closure() | ++-------+-------------------+ [Event] event2 +-------+-----------------------------------------------------------------------------------+ From 8691321e2671e464bfa7f223a658eb36502b17aa Mon Sep 17 00:00:00 2001 From: prepECN Date: Sun, 4 Jan 2015 19:47:55 +0100 Subject: [PATCH 025/240] [Console] - Remove deprecated methods from Command class --- .../Component/Console/Command/Command.php | 44 +------------------ .../Console/Tests/Command/CommandTest.php | 22 ---------- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 0302cb1753b51..b834d984f83ba 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -11,13 +11,10 @@ namespace Symfony\Component\Console\Command; -use Symfony\Component\Console\Descriptor\TextDescriptor; -use Symfony\Component\Console\Descriptor\XmlDescriptor; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Helper\HelperSet; @@ -345,7 +342,7 @@ public function getDefinition() } /** - * Gets the InputDefinition to be used to create XML and Text representations of this Command. + * Gets the InputDefinition to be used to create representations of this Command. * * Can be overridden to provide the original command representation when it would otherwise * be changed by merging with the application InputDefinition. @@ -600,45 +597,6 @@ public function getHelper($name) return $this->helperSet->get($name); } - /** - * Returns a text representation of the command. - * - * @return string A string representing the command - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. - */ - public function asText() - { - $descriptor = new TextDescriptor(); - $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); - $descriptor->describe($output, $this, array('raw_output' => true)); - - return $output->fetch(); - } - - /** - * Returns an XML representation of the command. - * - * @param bool $asDom Whether to return a DOM or an XML string - * - * @return string|\DOMDocument An XML string representing the command - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. - */ - public function asXml($asDom = false) - { - $descriptor = new XmlDescriptor(); - - if ($asDom) { - return $descriptor->getCommandDocument($this); - } - - $output = new BufferedOutput(); - $descriptor->describe($output, $this); - - return $output->fetch(); - } - /** * Validates a command name. * diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 36c14ddec54fb..8eede0563b437 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -317,26 +317,4 @@ public function callableMethodCommand(InputInterface $input, OutputInterface $ou { $output->writeln('from the code...'); } - - public function testLegacyAsText() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $command = new \TestCommand(); - $command->setApplication(new Application()); - $tester = new CommandTester($command); - $tester->execute(array('command' => $command->getName())); - $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); - } - - public function testLegacyAsXml() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $command = new \TestCommand(); - $command->setApplication(new Application()); - $tester = new CommandTester($command); - $tester->execute(array('command' => $command->getName())); - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); - } } From d0672a8f03a2f8948d8e5e8f4cb19da4d58bcd29 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 7 Jan 2015 08:38:21 +0100 Subject: [PATCH 026/240] removed CHANGELOGs and UPGRADEs for 2.x versions --- CHANGELOG-2.2.md | 352 ----------- CHANGELOG-2.3.md | 637 -------------------- CHANGELOG-2.4.md | 401 ------------- CHANGELOG-2.5.md | 301 ---------- CHANGELOG-2.6.md | 48 -- UPGRADE-2.1.md | 1478 ---------------------------------------------- UPGRADE-2.2.md | 668 --------------------- UPGRADE-2.3.md | 305 ---------- UPGRADE-2.4.md | 9 - UPGRADE-2.5.md | 263 --------- UPGRADE-2.6.md | 428 -------------- 11 files changed, 4890 deletions(-) delete mode 100644 CHANGELOG-2.2.md delete mode 100644 CHANGELOG-2.3.md delete mode 100644 CHANGELOG-2.4.md delete mode 100644 CHANGELOG-2.5.md delete mode 100644 CHANGELOG-2.6.md delete mode 100644 UPGRADE-2.1.md delete mode 100644 UPGRADE-2.2.md delete mode 100644 UPGRADE-2.3.md delete mode 100644 UPGRADE-2.4.md delete mode 100644 UPGRADE-2.5.md delete mode 100644 UPGRADE-2.6.md diff --git a/CHANGELOG-2.2.md b/CHANGELOG-2.2.md deleted file mode 100644 index 274ab05e9216e..0000000000000 --- a/CHANGELOG-2.2.md +++ /dev/null @@ -1,352 +0,0 @@ -CHANGELOG for 2.2.x -=================== - -This changelog references the relevant changes (bug and security fixes) done -in 2.2 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.2.0...v2.2.1 - -* 2.2.11 (2013-12-02) - - * bug #9656 [DoctrineBridge] normalized class names in the ORM type guesser (fabpot) - * bug #9647 use the correct class name to retrieve mapped class' metadata and reposi... (xabbuh) - * bug #9643 [WebProfilerBundle] Fixed js escaping in time.html.twig (hason) - * bug #9639 Modified guessDefaultEscapingStrategy to not escape txt templates (fabpot) - * bug #9314 [Form] Fix DateType for 32bits computers. (WedgeSama) - * bug #9443 [FrameworkBundle] Fixed the registration of validation.xml file when the form is disabled (hason) - * bug #9625 [HttpFoundation] Do not return an empty session id if the session was closed (Taluu) - * bug #9447 [BrowserKit] fixed protocol-relative url redirection (jong99) - * bug #9535 No Entity Manager defined exception (armetiz) - * bug #9485 [Acl] Fix for issue #9433 (guilro) - * bug #9516 [AclProvider] Fix incorrect behavior when partial results returned from cache (superdav42) - * bug #9537 [FrameworkBundle] Fix mistake in translation's service definition. (phpmike) - * bug #9367 [Process] Check if the pipe array is empty before calling stream_select() (jfposton) - * bug #9469 [Propel1] re-factor Propel1 ModelChoiceList (havvg) - -* 2.2.10 (2013-11-13) - - * bug #9499 Request::overrideGlobals() may call invalid ini value (denkiryokuhatsuden) - * bug #9212 [Validator] Force Luhn Validator to only work with strings (Richtermeister) - * bug #9431 [DependencyInjection] fixed YamlDumper did not make services private. (realityking) - * bug #9412 [HttpFoundation] added content length header to BinaryFileResponse (kbond) - * bug #9388 [Form] Fixed: The "data" option is taken into account even if it is NULL (bschussek) - * bug #9391 [Serializer] Fixed the error handling when decoding invalid XML to avoid a Warning (stof) - * bug #9378 [DomCrawler] [HttpFoundation] Make `Content-Type` attributes identification case-insensitive (matthieuprat) - * bug #9354 [Process] Fix #9343 : revert file handle usage on Windows platform (romainneutron) - * bug #9333 [Form] Improved FormTypeCsrfExtension to use the type class as default intention if the form name is empty (bschussek) - * bug #9338 [DoctrineBridge] Added type check to prevent calling clear() on arrays (bschussek) - * bug #9327 [Form] Changed FormTypeCsrfExtension to use the form's name as default intention (bschussek) - * bug #9308 [DoctrineBridge] Loosened CollectionToArrayTransformer::transform() to accept arrays (bschussek) - * bug #9274 [Yaml] Fixed the escaping of strings starting with a dash when dumping (stof) - * bug #9270 [Templating] Fix in ChainLoader.php (janschoenherr) - * bug #9246 [Session] fixed wrong started state (tecbot) - -* 2.2.9 (2013-10-10) - - * [Security] limited the password length passed to encoders - * bug #9237 [FrameworkBundle] assets:install command should mirror .dotfiles (.htaccess) (FineWolf) - * bug #9223 [Translator] PoFileDumper - PO headers (Padam87) - * bug #9257 [Process] Fix 9182 : random failure on pipes tests (romainneutron) - * bug #9222 [Bridge] [Propel1] Fixed guessed relations (ClementGautier) - * bug #9214 [FramworkBundle] Check event listener services are not abstract (lyrixx) - * bug #9207 [HttpKernel] Check for lock existence before unlinking (ollietb) - * bug #9184 Fixed cache warmup of paths which contain back-slashes (fabpot) - * bug #9192 [Form] remove MinCount and MaxCount constraints in ValidatorTypeGuesser (franek) - * bug #9190 Fix: duplicate usage of Symfony\Component\HttpFoundation\Response (realsim) - * bug #9188 [Form] add support for Length and Range constraint in ValidatorTypeGuesser (franek) - * bug #8809 [Form] enforce correct timezone (Burgov) - * bug #9169 Fixed client insulation when using the terminable event (fabpot) - * bug #9154 Fix problem with Windows file links (backslash in JavaScript string) (fabpot) - * bug #9103 [HttpFoundation] Header `HTTP_X_FORWARDED_PROTO` can contain various values (stloyd) - -* 2.2.8 (2013-09-25) - - * same as 2.2.7 - -* 2.2.7 (2013-09-25) - - * 8980954: bugix: CookieJar returns cookies with domain "domain.com" for domain "foodomain.com" - * 3108c71: [Locale] added support for the position argument to NumberFormatter::parse() - * 0774c79: [Locale] added some more stubs for the number formatter - * e5282e8: [DomCrawler]Crawler guess charset from html - * 0e80d88: fixes RequestDataCollector bug, visible when used on Drupal8 - * c8d0342: [Console] fixed exception rendering when nested styles - * a47d663: [Console] fixed the formatter for single-char tags - * c6c35b3: [Console] Escape exception message during the rendering of an exception - * 0e437c5: [BrowserKit] Fixed the handling of parameters when redirecting - * 958ec09: NativeSessionStorage regenerate - * 0d6af5c: Use setTimeZone if this method exists. - * 773e716: [HttpFoundation] Fixed the way path to directory is trimmed. - * 42019f6: [Console] Fixed argument parsing when a single dash is passed. - * b591419: [HttpFoundation] removed double-slashes (closes #8388) - * 4f5b8f0: [HttpFoundation] tried to keep the original Request URI as much as possible to avoid different behavior between ::createFromGlobals() and ::create() - * 4c1dbc7: [TwigBridge] fixed form rendering when used in a template with dynamic inheritance - * 8444339: [HttpKernel] added a check for private event listeners/subscribers - * ce7de37: [DependencyInjection] fixed a non-detected circular reference in PhpDumper (closes #8425) - * 37102dc: [Process] Close unix pipes before calling `proc_close` to avoid a deadlock - * 8c2a733: [HttpFoundation] fixed format duplication in Request - * 1e75cf9: [Process] Fix #8970 : read output once the process is finished, enable pipe tests on Windows - * ed83752: [Form] Fixed expanded choice field to be marked invalid when unknown choices are submitted - * 30aa1de: [Form] Fixed ChoiceList::get*By*() methods to preserve order and array keys - * 49f5027: [HttpKernel] fixer HInclude src (closes #8951) - * c567262: Fixed escaping of service identifiers in configuration - * 4a76c76: [Process][2.2] Fix Process component on windows - * 65814ba: Request->getPort() should prefer HTTP_HOST over SERVER_PORT - * e75d284: Fixing broken http auth digest in some circumstances (php-fpm + apache). - * 899f176: [Security] fixed a leak in ExceptionListener - * 2fd8a7a: [Security] fixed a leak in the ContextListener - * 4e9d990: Ignore posix_istatty warnings - * 2d34e78: [BrowserKit] fixed method/files/content when redirecting a request - * 64e1655: [BrowserKit] removed some headers when redirecting a request - * 96a4b00: [BrowserKit] fixed headers when redirecting if history is set to false (refs #8697) - * c931eb7: [HttpKernel] fixed route parameters storage in the Request data collector (closes #8867) - * 96bb731: optimized circular reference checker - * 91234cd: [HttpKernel] changed fragment URLs to be relative by default (closes #8458) - * 4922a80: [FrameworkBundle] added support for double-quoted strings in the extractor (closes #8797) - * 0d07af8: [BrowserKit] Pass headers when `followRedirect()` is called - * d400b5a: Return BC compatibility for `@Route` parameters and default values - -* 2.2.6 (2013-08-26) - - * f936b41: clearToken exception is thrown at wrong place. - * d0faf55: [Locale] Fixed: StubLocale::setDefault() throws no exception when "en" is passed - * 566d79c: [Yaml] fixed embedded folded string parsing - * 0951b8d: [Translation] Fixed regression: When only one rule is passed to transChoice(), this rule should be used - * 4563f1b: [Yaml] Fix comment containing a colon on a scalar line being parsed as a hash. - * 7e87eb1: fixed request format when forwarding a request - * ccaaedf: [Form] PropertyPathMapper::mapDataToForms() *always* calls setData() on every child to ensure that all *_DATA events were fired when the initialization phase is over (except for virtual forms) - * 00bc270: [Form] Fixed: submit() reacts to dynamic modifications of the form children - * 05fdb12: Fixed issue #6932 - Inconsistent locale handling in subrequests - * b3c3159: fixed locale of sub-requests when explicitely set by the developer (refs #8821) - * b72bc0b: [Locale] fixed build-data exit code in case of an error - * 9bb7a3d: fixed request format of sub-requests when explicitely set by the developer (closes #8787) - * fa35597: Sets _format attribute only if it wasn't set previously by the user. - * f946108: fixed the format of the request used to render an exception - * 51022c3: Fix typo in the check_path validator - * 5f7219e: added a missing use statement (closes #8808) - * 262879d: fix for Process:isSuccessful() - * 0723c10: [Process] Use a consistent way to reset data of the process latest run - * 85a9c9d: [HttpFoundation] Fixed removing a nonexisting namespaced attribute. - * 191d320: [Validation] Fixed IdentityTranslator to pass correct Locale to MessageSelector - * c6ecd83: SwiftMailerHandler in Monolog bridge now able to react to kernel.terminate event - * 99adcf1: {HttpFoundation] [Session] fixed session compatibility with memcached/redis session storage - * ab9a96b: Fixes for hasParameterOption and getParameterOption methods of ArgvInput - * dbd0855: Added sleep() workaround for windows php rename bug - * fa769a2: [Process] Add more precision to Process::stop timeout - * 3ef517b: [Process] Fix #8739 - * 18896d5a: [Validator] fixed the wrong isAbstract() check against the class (fixed #8589) - * e8e76ec: [TwigBridge] Prevent code extension to display warning - * 1a73b44: added missing support for the new output API in PHP 5.4+ - * e0c7d3d: Fixed bug introduced in #8675 - * 0b965fb: made the filesystem loader compatible with Twig 2.0 - * 322f880: replaced deprecated Twig features - -* 2.2.5 (2013-08-07) - - * c35cc5b: added trusted hosts check - * 6d555bc: Fixed metadata serialization - * cd51d82: [Form] fixed wrong call to setTimeZone() (closes #8644) - * 5c359a8: Fix issue with \DateTimeZone::UTC / 'UTC' for PHP 5.4 - * 97cbb19: [Form] Removed the "disabled" attribute from the placeholder option in select fields due to problems with the BlackBerry 10 browser - * c138304: [routing] added ability for apache matcher to handle array values - * b41cf82: [Validator] fixed StaticMethodLoader trying to invoke methods of abstract classes (closes #8589) - * 3553c71: return 0 if there is no valid data - * ae7fa11: [Twig] fixed TwigEngine::exists() method when a template contains a syntax error (closes #8546) - * 28e0709: [Validator] fixed ConstraintViolation:: incorrect when nested - * 890934d: handle Optional and Required constraints from XML or YAML sources correctly - * a2eca45: Fixed #8455: PhpExecutableFinder::find() does not always return the correct binary - * 485d53a: [DependencyInjection] Fix Container::camelize to convert beginning and ending chars - * 2317443: [Security] fixed issue where authentication listeners clear unrelated tokens - * 2ebb783: fix issue #8499 modelChoiceList call getPrimaryKey on a non object - * d3eb9b7: [Validator] Fixed groups argument misplace for validateValue method from validator class - -* 2.2.4 (2013-07-15) - - * 52e530d: Fixed NativeSessionStorage:regenerate when does not exists - * bb59f40: Reverts JSON_NUMERIC_CHECK - * 9c5f8c6: [Yaml] removed wrong comment removal inside a string block - * 2dc1ee0: [HtppKernel] fixed inline fragment renderer - * 06b69b8: fixed inline fragment renderer - * 91bb757: ProgressHelper shows percentage complete. - * 9d1004b: fix handling of a default 'template' as a string - * 82dbaee: [HttpKernel] fixed the inline renderer when passing objects as attributes (closes #7124) - * 6dbd1e1: [WebProfiler] fix content-type parameter - * a830001: Passed the config when building the Configuration in ConfigurableExtension - * c875d0a: [Form] fixed INF usage which does not work on Solaris (closes #8246) - -* 2.2.3 (2013-06-19) - - * c0da3ae: [Process] Disable exception on stream_select timeout - * 77f2aa8: [HttpFoundation] fixed issue with session_regenerate_id (closes #7380) - * bcbbb28: Throw exception if value is passed to VALUE_NONE input, long syntax - * 6b71513: fixed date type format pattern regex - * 842f3fa: do not re-register commands each time a Console\Application is run - * 0991cd0: [Process] moved env check to the Process class (refs #8227) - * 8764944: fix issue where $_ENV contains array vals - * 4139936: [DomCrawler] Fix handling file:// without a host - * de289d2: [Form] corrected interface bind() method defined against in deprecation notice - * 0c0a3e9: [Console] fixed regression when calling a command foo:bar if there is another one like foo:bar:baz (closes #8245) - * 849f3ed: [Finder] Fix SplFileInfo::getContents isn't working with ssh2 protocol - * 25e3abd: fix many-to-many Propel1 ModelChoiceList - * bce6bd2: [DomCrawler] Fixed a fatal error when setting a value in a malformed field name. - * 445b2e3: [Console] fix status code when Exception::getCode returns something like 0.1 - * bbfde62: Fixed exit code for exceptions with error code 0 - * afad9c7: instantiate valid commands only - * 6d2135b: force the Content-Type to html in the web profiler controllers - -* 2.2.2 (2013-06-02) - - * 2038329: [Form] [Validator] Fixed post_max_size = 0 bug (Issue #8065) - * 169c0b9: [Finder] Fix iteration fails with non-rewindable streams - * 45b68e0: [Finder] Fix unexpected duplicate sub path related AppendIterator issue - * 5321600: Fixed two bugs in HttpCache - * 5c317b7: [Console] fix and refactor exit code handling - * 1469953: [CssSelector] Fix :nth-last-child() translation - * 91b8490: Fix Crawler::children() to not trigger a notice for childless node - * 0a4837d: Fixed XML syntax. - * a5441b2: Fixed parsing of leading blank lines in folded scalars. Closes #7989. - * ef87ba7: [Form] Fixed a method name. - * e8d5d16: Fixed Loader import - * 60edc58: Fixed fatal error in normalize/denormalizeObject. - * 05b987f: [Process] Cleanup tests & prevent assertion that kills randomly Travis-CI - * e4913f8: [Filesystem] Fix regression introduced in 10dea948 - * 5b7e1e6: added a missing check for the provider key - * b0e3ea5: [Validator] fixed wrong URL for XSD - * 59b78c7: [Validator] Fixed: $traverse and $deep is passed to the visitor from Validator::validate() - * bcb5400: [Form] Fixed transform()/reverseTransform() to always throw TransformationFailedExceptions - * 7b2ebbf: [Form] Fixed: String validation groups are never interpreted as callbacks - * 0610750: if the repository method returns an array ensure that it's internal poin... - * dcced01: [Form] Improved multi-byte handling of NumberToLocalizedStringTransformer - * 2b554d7: remove validation related headers when needed - * 2a531d7: Fix getPort() returning 80 instead of 443 when X-FORWARDED-PROTO is set to https - * 10dea94: [Filesystem] copy() is not working when open_basedir is set - * 8757ad4: [Process] Fix #5594 : `termsig` must be used instead of `stopsig` in exceptions when a process is signaled - * be34917: [Console] find command even if its name is a namespace too (closes #7860) - * 3c97004: Reset all catalogues when adding resource to fallback locale (#7715, #7819) - * 0fb35a4: Added reloading of fallback catalogues when calling addResource() (#7715) - * 9e49bc8: Re-added context information to log list - * 06e21ff: Filesystem::touch() not working with different owners (utime/atime issue) - * d98118a: [Config] #7644 add tests for passing number looking attributes as strings - * 36d057b: [HttpFoundation][BrowserKit] fixed path when converting a cookie to a string - * 495d0e3: [HttpFoundation] fixed empty domain= in Cookie::__toString() - * c2bc707: fixed detection of secure cookies received over https - * af819a7: [2.2] Pass ESI header to subrequests - * 54bcf5c: [Translator] added additional conversion for encodings other than utf-8 - * 67b5797: fixed source messages to accept pluralized messages [Validator][translation][japanese] add messages for new validator - * 8a434ed: fix a DI circular reference recognition bug - * 22bf965: [DependencyInjection] fixed wrong exception class - * 5abf887: Fix default value handling for multi-value options - * da156d3: fix overwriting of request's locale if attribute _locale is missing - * 1adbe3c: [HttpKernel] truncate profiler token to 6 chars (see #7665) - * d552e4c: [HttpFoundation] do not use server variable PATH_INFO because it is already decoded and thus symfony is fragile to double encoding of the path - * 4c51ec7: Fix download over SSL using IE < 8 and binary file response - * 46909fa: [Console] Fix merging of application definition, fixes #7068, replaces #7158 - * 972bde7: [HttpKernel] fixed the Kernel when the ClassLoader component is not available (closes #7406) - * f163226: fixed output of bag values - * 047212a: [Yaml] fixed handling an empty value - * 94a9cdc: [Routing][XML Loader] Add a possibility to set a default value to null - * 302d44f: [Console] fixed handling of "0" input on ask - * 383a84b: fixed handling of "0" input on ask - * 0f0c29c: [HttpFoundation] Fixed bug in key searching for NamespacedAttributeBag - * 7fc429f: [Form] DateTimeToRfc3339Transformer use proper transformation exteption in reverse transformation - * 9fcd2f6: [HttpFoundation] fixed the creation of sub-requests under some circumstances for IIS - * 8a9e898: Fix finding ACLs from ObjectIdentity's with different types - * a3826ab: #7531: [HttpKernel][Config] FileLocator adds NULL as global resource path - * 9d71ebe: Fix autocompletion of command names when namespaces conflict - * bec8ff1: Fix timeout in Process::stop method - * 3780fdb: Fix Process timeout - * 99256e4: [HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259 - * e8cae94: fix overwriting of request's locale if attribute _locale is missing - * c4da2d9: [HttpFoundation] getClientIp is fixed. - -* 2.2.1 (2013-04-06) - - * 751abe1: Doctrine cannot handle bare random non-utf8 strings - * 673fd9b: idAsIndex should be true with a smallint or bigint id field. - * 64a1d39: Fixed long multibyte parameter logging in DbalLogger:startQuery - * 4cf06c1: Keep the file extension in the temporary copy and test that it exists (closes #7482) - * 64ac34d: [Security] fixed wrong interface - * 9875c4b: Added '@@' escaping strategy for YamlFileLoader and YamlDumper - * bbcdfe2: [Yaml] fixed bugs with folded scalar parsing - * 5afea04: [Form] made DefaultCsrfProvider using session_status() when available - * c928ddc: [HttpFoudantion] fixed Request::getPreferredLanguage() - * e6b7515: [DomCrawler] added support for query string with slash - * 633c051: Fixed invalid file path for hiddeninput.exe on Windows. - * 7ef90d2: fix xsd definition for strict-requirements - * 39445c5: [WebProfilerBundle] Fixed the toolbar styles to apply them in IE8 - * 601da45: [ClassLoader] fixed heredocs handling - * 17dc2ff: [HttpRequest] fixes Request::getLanguages() bug - * 67fbbac: [DoctrineBridge] Fixed non-utf-8 recognition - * e51432a: sub-requests are now created with the same class as their parent - * cc3a40e: [FrameworkBundle] changed temp kernel name in cache:clear - * d7a7434: [Routing] fix url generation for optional parameter having a null value - * ef53456: [DoctrineBridge] Avoids blob values to be logged by doctrine - * 6575df6: [Security] use current request attributes to generate redirect url? - * 7216cb0: [Validator] fix showing wrong max file size for upload errors - * c423f16: [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge - * 7d87ecd: [FrameworkBundle] fixed cache:clear command's warmup - * 5ad4bd1: [TwigBridge] now enter/leave scope on Twig_Node_Module - * fe4cc24: [TwigBridge] fixed fixed scope & trans_default_domain node visitor - * fc47589: [BrowserKit] added ability to ignored malformed set-cookie header - * 602cdee: replace INF to PHP_INT_MAX inside Finder component. - * 5bc30bb: [Translation] added xliff loader/dumper with resname support - * 663c796: Property accessor custom array object fix - * 4f3771d: [2.2][HttpKernel] fixed wrong option name in FragmentHandler::fixOptions - * a735cbd: fix xargs pipe to work with spaces in dir names - * 15bf033: [FrameworkBundle] fix router debug command - * d16d193: [FramworkBundle] removed unused property of trans update command - * 523ef29: Fix warning for buildXml method - * 7241be9: [Finder] fixed a potential issue on Solaris where INF value is wrong (refs #7269) - * 1d3da29: [FrameworkBundle] avoids cache:clear to break if new/old folders already exist - * b9cdb9a: [HttpKernel] Fixed possible profiler token collision (closes #7272, closes #7171) - * d1f5d25: [FrameworkBundle] Fixes invalid serialized objects in cache - * c82c754: RedisProfilerStorage wrong db-number/index-number selected - * e86fefa: Unset loading[$id] in ContainerBuilder on exception - * 709518b: Default validation message translation fix. - * c0687cd: remove() should not use deprecated getParent() so it does not trigger deprecation internally - * 708c0d3: adjust routing tests to not use prefix in addCollection - * acff735: [Routing] trigger deprecation warning for deprecated features that will be removed in 2.3 - * 41ad9d8: [Routing] make xml loader more tolerant - * 73bead7: [ClassLoader] made DebugClassLoader idempotent - * a4ec677: [DomCrawler] Fix relative path handling in links - * 6681df0: [Console] fixed StringInput binding - * 5bf2f71: [Console] added deprecation annotation - * 8d9cd42: Routing issue with installation in a sub-directory ref: https://github.com/symfony/symfony/issues/7129 - * c97ee8d: [Translator] mention that the message id may also be an object that can be cast to string in TranslatorInterface and fix the IdentityTranslator that did not respect this - * 5a36b2d: [Translator] fix MessageCatalogueInterface::getFallbackCatalogue that can return null - -* 2.2.0 (2013-03-01) - - * 5b19c89: [Console] fixed unparsed StringInput tokens - * e92b76c: Mask PHP_AUTH_PW header in profiler - * bae83c7: [TwigBridge] fixed trans twig extractor - * f40adbc: [Finder] adds adapter selection/unselection capabilities - * 8f8ba38: [DomCrawler] fix handling of schemes by Link::getUri() - * 83382bc: [TwigBridge] fixed the translator extractor that were not trimming the text in trans tags (closes #7056) - * b1ea8e5: Fixed handling absent href attribute in base tag - * 83a61cf: fixed paths/notPaths regex for shell adapters - * 32c5bf7: fix issue 4911 - * 13b8ce0: Adds expandable globs support to shell adapters - * 850bd5a: [HttpFoundation] Fixed messed up headers - * 4ecc246: Fixes AppCache + ESI + Stopwatch problem - * 0690709: added a DebuClassLoader::findFile() method to make the wrapping less invasive - * da22926: [Validator] gracefully handle transChoice errors - * 635b1fc: StringInput resets the given options - -* 2.2.0-RC3 (2013-02-24) - - * b2080c4: [HttpFoundation] Remove Cache-Control when using https download via IE<9 (fixes #6750) - * b7bd630: [Form] Fixed TimeType not to render a "size" attribute in select tags - * 368f62f: Expanded fault-tolerance for unusual cookie dates - * 171cff0: [FrameworkBundle] Fix a BC for Hinclude global template - * 3e40c17: [HttpKernel] fixed locale management when exiting sub-requests - * 3933912: fixed HInclude renderer (closes #7113) - * 189fba6: Removed some leaking deprecation warning in the Form component - * d0e4b76: [HttpFoundation] fixed, overwritten CONTENT_TYPE - * 609636e: [Config] tweaked dumper to indent multi-line info - * 0eff68f: Fix REMOTE_ADDR for cached subrequests - * 54d7d25: [HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html - * f842ae6: [FrameworkBundle] CSRF should be on by default - * cb319ac: [HttpKernel] added error display suppression when using the ErrorHandler (if not, errors are displayed twice, refs #6254) - * de0f7b7: [HttpFoundation] Added getter for httpMethodParameterOverride state diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md deleted file mode 100644 index 1fa2df288dac1..0000000000000 --- a/CHANGELOG-2.3.md +++ /dev/null @@ -1,637 +0,0 @@ -CHANGELOG for 2.3.x -=================== - -This changelog references the relevant changes (bug and security fixes) done -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.23 (2014-12-03) - - * bug #12811 Configure firewall's kernel exception listener with configured entry point or a default entry point (rjkip) - * bug #12784 [DependencyInjection] make paths relative to __DIR__ in the generated container (nicolas-grekas) - * bug #12716 [ClassLoader] define constant only if it wasn't defined before (xabbuh) - * bug #12553 [Debug] fix error message on double exception (nicolas-grekas) - * bug #12550 [FrameworkBundle] backport #12489 (xabbuh) - * bug #12570 Fix initialized() with aliased services (Daniel Wehner) - * bug #12137 [FrameworkBundle] cache:clear command fills *.php.meta files with wrong data (Strate) - -* 2.3.22 (2014-11-20) - - * bug #12525 [Bundle][FrameworkBundle] be smarter when guessing the document root (xabbuh) - * bug #12296 [SecurityBundle] Authentication entry point is only registered with firewall exception listener, not with authentication listeners (rjkip) - * bug #12393 [DependencyInjection] inlined factory not referenced (boekkooi) - * bug #12436 [Filesystem] Fixed case for empty folder (yosmanyga) - * bug #12370 [Yaml] improve error message for multiple documents (xabbuh) - * bug #12170 [Form] fix form handling with OPTIONS request method (Tobion) - * bug #12235 [Validator] Fixed Regex::getHtmlPattern() to work with complex and negated patterns (webmozart) - * bug #12326 [Session] remove invalid hack in session regenerate (Tobion) - * bug #12341 [Kernel] ensure session is saved before sending response (Tobion) - * bug #12329 [Routing] serialize the compiled route to speed things up (Tobion) - * bug #12316 Break infinite loop while resolving aliases (chx) - * bug #12313 [Security][listener] change priority of switchuser (aitboudad) - -* 2.3.21 (2014-10-24) - - * bug #11696 [Form] Fix #11694 - Enforce options value type check in some form types (kix) - * bug #12209 [FrameworkBundle] Fixed ide links (hason) - * bug #12208 Add missing argument (WouterJ) - * bug #12197 [TwigBundle] do not pass a template reference to twig (Tobion) - * bug #12196 [TwigBundle] show correct fallback exception template in debug mode (Tobion) - * bug #12187 [CssSelector] don't raise warnings when exception is thrown (xabbuh) - * bug #11998 [Intl] Integrated ICU data into Intl component #2 (webmozart) - * bug #11920 [Intl] Integrated ICU data into Intl component #1 (webmozart) - -* 2.3.20 (2014-09-28) - - * bug #9453 [Form][DateTime] Propagate invalid_message & invalid_message_parameters to date & time (egeloen) - * bug #11058 [Security] bug #10242 Missing checkPreAuth from RememberMeAuthenticationProvider (glutamatt) - * bug #12004 [Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required (webmozart) - * bug #11904 Make twig ExceptionController conformed with ExceptionListener (megazoll) - * bug #11924 [Form] Moved POST_MAX_SIZE validation from FormValidator to request handler (rpg600, webmozart) - * bug #11079 Response::isNotModified returns true when If-Modified-Since is later than Last-Modified (skolodyazhnyy) - * bug #11989 [Finder][Urgent] Remove asterisk and question mark from folder name in test to prevent windows file system issues. (Adam) - * bug #11908 [Translation] [Config] Clear libxml errors after parsing xliff file (pulzarraider) - * bug #11937 [HttpKernel] Make sure HttpCache is a trusted proxy (thewilkybarkid) - * bug #11970 [Finder] Escape location for regex searches (ymc-dabe) - * bug #11837 Use getPathname() instead of string casting to get BinaryFileReponse file path (nervo) - * bug #11513 [Translation] made XliffFileDumper support CDATA sections. (hhamon) - * bug #11907 [Intl] Improved bundle reader implementations (webmozart) - * bug #11874 [Console] guarded against non-traversable aliases (thierrymarianne) - * bug #11799 [YAML] fix handling of empty sequence items (xabbuh) - * bug #11906 [Intl] Fixed a few bugs in TextBundleWriter (webmozart) - * bug #11459 [Form][Validator] All index items after children are to be considered grand-children when resolving ViolationPath (Andrew Moore) - * bug #11715 [Form] FormBuilder::getIterator() now deals with resolved children (issei-m) - * bug #11892 [SwiftmailerBridge] Bump allowed versions of swiftmailer (ymc-dabe) - * bug #11918 [DependencyInjection] remove `service` parameter type from XSD (xabbuh) - * bug #11905 [Intl] Removed non-working $fallback argument from ArrayAccessibleResourceBundle (webmozart) - * bug #11497 Use separated function to resolve command and related arguments (JJK801) - * bug #11374 [DI] Added safeguards against invalid config in the YamlFileLoader (stof) - * bug #11897 [FrameworkBundle] Remove invalid markup (flack) - * bug #11860 [Security] Fix usage of unexistent method in DoctrineAclCache. (mauchede) - * bug #11850 [YAML] properly mask escape sequences in quoted strings (xabbuh) - * bug #11856 [FrameworkBundle] backport more error information from 2.6 to 2.3 (xabbuh) - * bug #11843 [Yaml] improve error message when detecting unquoted asterisks (xabbuh) - -* 2.3.19 (2014-09-03) - - * security #11832 CVE-2014-6072 (fabpot) - * security #11831 CVE-2014-5245 (stof) - * security #11830 CVE-2014-4931 (aitboudad, Jérémy Derussé) - * security #11829 CVE-2014-6061 (damz, fabpot) - * security #11828 CVE-2014-5244 (nicolas-grekas, larowlan) - * bug #10197 [FrameworkBundle] PhpExtractor bugfix and improvements (mtibben) - * bug #11772 [Filesystem] Add FTP stream wrapper context option to enable overwrite (Damian Sromek) - * bug #11788 [Yaml] fixed mapping keys containing a quoted # (hvt, fabpot) - * bug #11160 [DoctrineBridge] Abstract Doctrine Subscribers with tags (merk) - * bug #11768 [ClassLoader] Add a __call() method to XcacheClassLoader (tstoeckler) - * bug #11726 [Filesystem Component] mkdir race condition fix #11626 (kcassam) - * bug #11677 [YAML] resolve variables in inlined YAML (xabbuh) - * bug #11639 [DependencyInjection] Fixed factory service not within the ServiceReferenceGraph. (boekkooi) - * bug #11778 [Validator] Fixed wrong translations for Collection constraints (samicemalone) - * bug #11756 [DependencyInjection] fix @return anno created by PhpDumper (jakubkulhan) - * bug #11711 [DoctrineBridge] Fix empty parameter logging in the dbal logger (jakzal) - * bug #11692 [DomCrawler] check for the correct field type (xabbuh) - * bug #11672 [Routing] fix handling of nullable XML attributes (xabbuh) - * bug #11624 [DomCrawler] fix the axes handling in a bc way (xabbuh) - * bug #11676 [Form] Fixed #11675 ValueToDuplicatesTransformer accept "0" value (Nek-) - * bug #11695 [Validators] Fixed failing tests requiring ICU 52.1 which are skipped otherwise (webmozart) - * bug #11529 [WebProfilerBundle] Fixed double height of canvas (hason) - * bug #11641 [WebProfilerBundle ] Fix toolbar vertical alignment (blaugueux) - * bug #11559 [Validator] Convert objects to string in comparison validators (webmozart) - * feature #11510 [HttpFoundation] MongoDbSessionHandler supports auto expiry via configurable expiry_field (catchamonkey) - * bug #11408 [HttpFoundation] Update QUERY_STRING when overrideGlobals (yguedidi) - * bug #11633 [FrameworkBundle] add missing attribute to XSD (xabbuh) - * bug #11601 [Validator] Allow basic auth in url when using UrlValidator. (blaugueux) - * bug #11609 [Console] fixed style creation when providing an unknown tag option (fabpot) - * bug #10914 [HttpKernel] added an analyze of environment parameters for built-in server (mauchede) - * bug #11598 [Finder] Shell escape and windows support (Gordon Franke, gimler) - * bug #11499 [BrowserKit] Fixed relative redirects for ambiguous paths (pkruithof) - * bug #11516 [BrowserKit] Fix browser kit redirect with ports (dakota) - * bug #11545 [Bundle][FrameworkBundle] built-in server: exit when docroot does not exist (xabbuh) - * bug #11560 Plural fix (1emming) - * bug #11558 [DependencyInjection] Fixed missing 'factory-class' attribute in XmlDumper output (kerdany) - * bug #11548 [Component][DomCrawler] fix axes handling in Crawler::filterXPath() (xabbuh) - * bug #11422 [DependencyInjection] Self-referenced 'service_container' service breaks garbage collection (sun) - * bug #11428 [Serializer] properly handle null data when denormalizing (xabbuh) - * bug #10687 [Validator] Fixed string conversion in constraint violations (eagleoneraptor, webmozart) - * bug #11475 [EventDispatcher] don't count empty listeners (xabbuh) - * bug #11436 fix signal handling in wait() on calls to stop() (xabbuh, romainneutron) - * bug #11469 [BrowserKit] Fixed server HTTP_HOST port uri conversion (bcremer, fabpot) - * bug #11425 Fix issue described in #11421 (Ben, ben-rosio) - * bug #11423 Pass a Scope instance instead of a scope name when cloning a container in the GrahpvizDumper (jakzal) - * bug #11120 [Process] Reduce I/O load on Windows platform (romainneutron) - * bug #11342 [Form] Check if IntlDateFormatter constructor returned a valid object before using it (romainneutron) - * bug #11411 [Validator] Backported #11410 to 2.3: Object initializers are called only once per object (webmozart) - * bug #11403 [Translator][FrameworkBundle] Added @ to the list of allowed chars in Translator (takeit) - * bug #11381 [Process] Use correct test for empty string in UnixPipes (whs, romainneutron) - -* 2.3.18 (2014-07-15) - - * [Security] Forced validate of locales passed to the translator - * feature #11367 [HttpFoundation] Fix to prevent magic bytes injection in JSONP responses... (CVE-2014-4671) (Andrew Moore) - * bug #11386 Remove Spaceless Blocks from Twig Form Templates (chrisguitarguy) - * bug #9719 [TwigBundle] fix configuration tree for paths (mdavis1982, cordoval) - * bug #11244 [HttpFoundation] Remove body-related headers when sending the response, if body is empty (SimonSimCity) - -* 2.3.17 (2014-07-07) - - * bug #11238 [Translation] Added unescaping of ids in PoFileLoader (JustBlackBird) - * bug #11194 [DomCrawler] Remove the query string and the anchor of the uri of a link (benja-M-1) - * bug #11272 [Console] Make sure formatter is the same. (akimsko) - * bug #11259 [Config] Fixed failed config schema loads due to libxml_disable_entity_loader usage (ccorliss) - * bug #11234 [ClassLoader] fixed PHP warning on PHP 5.3 (fabpot) - * bug #11179 [Process] Fix ExecutableFinder with open basedir (cs278) - * bug #11242 [CssSelector] Refactored the CssSelector to remove the circular object graph (stof) - * bug #11219 [DomCrawler] properly handle buttons with single and double quotes insid... (xabbuh) - * bug #11220 [Components][Serializer] optional constructor arguments can be omitted during the denormalization process (xabbuh) - * bug #11186 Added missing `break` statement (apfelbox) - * bug #11169 [Console] Fixed notice in DialogHelper (florianv) - * bug #11144 [HttpFoundation] Fixed Request::getPort returns incorrect value under IPv6 (kicken) - * bug #10966 PHP Fatal error when getContainer method of ContainerAwareCommand has be... (kevinvergauwen) - * bug #10981 [HttpFoundation] Fixed isSecure() check to be compliant with the docs (Jannik Zschiesche) - * bug #11092 [HttpFoundation] Fix basic authentication in url with PHP-FPM (Kdecherf) - * bug #10808 [DomCrawler] Empty select with attribute name="foo[]" bug fix (darles) - * bug #11063 [HttpFoundation] fix switch statement (Tobion) - * bug #11009 [HttpFoundation] smaller fixes for PdoSessionHandler (Tobion) - * bug #11041 Remove undefined variable $e (skydiablo) - -* 2.3.16 (2014-05-31) - - * bug #11014 [Validator] Remove property and method targets from the optional and required constraints (jakzal) - * bug #10983 [DomCrawler] Fixed charset detection in html5 meta charset tag (77web) - * bug #10979 Make rootPath part of regex greedy (artursvonda) - * bug #10995 [TwigBridge][Trans]set %count% only on transChoice from the current context. (aitboudad) - * bug #10987 [DomCrawler] Fixed a forgotten case of complex XPath queries (stof) - -* 2.3.15 (2014-05-22) - - * reverted #10908 - -* 2.3.14 (2014-05-22) - - * bug #10849 [WIP][Finder] Fix wrong implementation on sortable callback comparator (ProPheT777) - * bug #10929 [Process] Add validation on Process input (romainneutron) - * bug #10958 [DomCrawler] Fixed filterXPath() chaining loosing the parent DOM nodes (stof, robbertkl) - * bug #10953 [HttpKernel] fixed file uploads in functional tests without file selected (realmfoo) - * bug #10937 [HttpKernel] Fix "absolute path" when we look to the cache directory (BenoitLeveque) - * bug #10908 [HttpFoundation] implement session locking for PDO (Tobion) - * bug #10894 [HttpKernel] removed absolute paths from the generated container (fabpot) - * bug #10926 [DomCrawler] Fixed the initial state for options without value attribute (stof) - * bug #10925 [DomCrawler] Fixed the handling of boolean attributes in ChoiceFormField (stof) - * bug #10777 [Form] Automatically add step attribute to HTML5 time widgets to display seconds if needed (tucksaun) - * bug #10909 [PropertyAccess] Fixed plurals for -ves words (csarrazi) - * bug #10899 Explicitly define the encoding. (jakzal) - * bug #10897 [Console] Fix a console test (jakzal) - * bug #10896 [HttpKernel] Fixed cache behavior when TTL has expired and a default "global" TTL is defined (alquerci, fabpot) - * bug #10841 [DomCrawler] Fixed image input case sensitive (geoffrey-brier) - * bug #10714 [Console]Improve formatter for double-width character (denkiryokuhatsuden) - * bug #10872 [Form] Fixed TrimListenerTest as of PHP 5.5 (webmozart) - * bug #10762 [BrowserKit] Allow URLs that don't contain a path when creating a cookie from a string (thewilkybarkid) - * bug #10863 [Security] Add check for supported attributes in AclVoter (artursvonda) - * bug #10833 [TwigBridge][Transchoice] set %count% from the current context. (aitboudad) - * bug #10820 [WebProfilerBundle] Fixed profiler seach/homepage with empty token (tucksaun) - * bug #10815 Fixed issue #5427 (umpirsky) - * bug #10817 [Debug] fix #10313: FlattenException not found (nicolas-grekas) - * bug #10803 [Debug] fix ErrorHandlerTest when context is not an array (nicolas-grekas) - * bug #10801 [Debug] ErrorHandler: remove $GLOBALS from context in PHP5.3 fix #10292 (nicolas-grekas) - * bug #10797 [HttpFoundation] Allow File instance to be passed to BinaryFileResponse (anlutro) - * bug #10643 [TwigBridge] Removed strict check when found variables inside a translation (goetas) - -* 2.3.13 (2014-04-27) - - * bug #10789 [Console] Fixed the rendering of exceptions on HHVM with a terminal width (stof) - * bug #10773 [WebProfilerBundle ] Fixed an edge case on WDT loading (tucksaun) - * bug #10763 [Process] Disable TTY mode on Windows platform (romainneutron) - * bug #10772 [Finder] Fix ignoring of unreadable dirs in the RecursiveDirectoryIterator (jakzal) - * bug #10757 [Process] Setting STDIN while running should not be possible (romainneutron) - * bug #10749 Fixed incompatibility of x509 auth with nginx (alcaeus) - * bug #10735 [Translation] [PluralizationRules] Little correction for case 'ar' (klyk50) - * bug #10720 [HttpFoundation] Fix DbalSessionHandler (Tobion) - * bug #10721 [HttpFoundation] status 201 is allowed to have a body (Tobion) - * bug #10728 [Process] Fix #10681, process are failing on Windows Server 2003 (romainneutron) - * bug #10733 [DomCrawler] Textarea value should default to empty string instead of null. (Berdir) - * bug #10723 [Security] fix DBAL connection typehint (Tobion) - * bug #10700 Fixes various inconsistencies in the code (fabpot) - * bug #10697 [Translation] Make IcuDatFileLoader/IcuResFileLoader::load invalid resource compatible with HHVM. (idn2104) - * bug #10652 [HttpFoundation] fix PDO session handler under high concurrency (Tobion) - * bug #10669 [Profiler] Prevent throwing fatal errors when searching timestamps or invalid dates (stloyd) - * bug #10670 [Templating] PhpEngine should propagate charset to its helpers (stloyd) - * bug #10665 [DependencyInjection] Fix ticket #10663 - Added setCharset method call to PHP templating engine (koku) - * bug #10654 Changed the typehint of the EsiFragmentRenderer to the interface (stof) - * bug #10649 [BrowserKit] Fix #10641 : BrowserKit is broken when using ip as host (romainneutron) - -* 2.3.12 (2014-04-03) - - * bug #10586 Fixes URL validator to accept single part urls (merk) - * bug #10591 [Form] Buttons are now disabled if their containing form is disabled (webmozart) - * bug #10579 HHVM fixes (fabpot) - * bug #10564 fixed the profiler when an uncalled listener throws an exception when instantiated (fabpot) - * bug #10568 [Form] Fixed hashing of choice lists containing non-UTF-8 characters (webmozart) - * bug #10536 Avoid levenshtein comparison when using ContainerBuilder. (catch56) - * bug #10549 Fixed server values in BrowserKit (fabpot) - * bug #10540 [HttpKernel] made parsing controllers more robust (fabpot) - * bug #10545 [DependencyInjection] Fixed YamlFileLoader imports path (jrnickell) - * bug #10523 [Debug] Check headers sent before sending PHP response (GromNaN) - * bug #10275 [Validator] Fixed ACE domain checks on UrlValidator (#10031) (aeoris) - * bug #10123 handle array root element (greg0ire) - * bug #10532 Fixed regression when using Symfony on filesystems without chmod support (fabpot) - * bug #10502 [HttpKernel] Fix #10437: Catch exceptions when reloading a no-cache request (romainneutron) - * bug #10493 Fix libxml_use_internal_errors and libxml_disable_entity_loader usage (romainneutron) - * bug #9784 [HttpFoundation] Removed ini check to make Uploadedfile work on Google App Engine (micheleorselli) - * bug #10416 [Form] Allow options to be grouped by objects (felds) - * bug #10410 [Form] Fix "Array was modified outside object" in ResizeFormListener. (Chekote) - * bug #10494 [Validator] Minor fix in IBAN validator (sprain) - * bug #10491 Fixed bug that incorrectly causes the "required" attribute to be omitted from select even though it contains the "multiple" attribute (fabpot) - * bug #10479 [Process] Fix escaping on Windows (romainneutron) - * bug #10480 [Process] Fixed fatal errors in getOutput and getErrorOutput when process was not started (romainneutron) - * bug #10420 [Process] Make Process::start non-blocking on Windows platform (romainneutron) - * bug #10455 [Process] Fix random failures in test suite on TravisCI (romainneutron) - * bug #10448 [Process] Fix quoted arguments escaping (romainneutron) - * bug #10444 [DomCrawler] Fixed incorrect value name conversion in getPhpValues() and getPhpFiles() (romainneutron) - * bug #10423 [Config] XmlUtils::convertDomElementToArray does not handle '0' (bendavies) - * bug #10153 [Process] Fixed data in pipe being truncated if not read before process termination (astephens25) - * bug #10429 [Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails (romainneutron) - * bug #10412 [Process] Fix process status in TTY mode (romainneutron) - * bug #10382 10158 get vary multiple (bbinkovitz) - * bug #10251 [Form] Fixes empty file-inputs getting treated as extra field. (jenkoian) - * bug #10351 [HttpKernel] fix stripComments() normalizing new-lines (sstok) - * bug #10348 Update FileLoader to fix issue #10339 (msumme) - -* 2.3.11 (2014-02-27) - - * bug #10146 [WebProfilerBundle] fixed parsing Mongo DSN and added Test for it (malarzm) - * bug #10299 [Finder] () is also a valid delimiter (WouterJ) - * bug #10255 [FrameworkBundle] Fixed wrong redirect url if path contains some query parameters (pulzarraider) - * bug #10285 Bypass sigchild detection if phpinfo is not available (Seldaek) - * bug #10269 [Form] Revert "Fix "Array was modified outside object" in ResizeFormListener." (norzechowicz) - -* 2.3.10 (2014-02-12) - - * bug #10231 [Console] removed problematic regex (fabpot) - * bug #10245 [DomCrawler] Added support for tags to be treated as links (shamess) - * bug #10232 [Form] Fix "Array was modified outside object" in ResizeFormListener. (Chekote) - * bug #10215 [Routing] reduced recursion in dumper (arnaud-lb) - * bug #10207 [DomCrawler] Fixed filterXPath() chaining (robbertkl) - * bug #10205 [DomCrawler] Fixed incorrect handling of image inputs (robbertkl) - * bug #10191 [HttpKernel] fixed wrong reference in TraceableEventDispatcher (fabpot) - * bug #10195 [Debug] Fixed recursion level incrementing in FlattenException::flattenArgs(). (sun) - * bug #10151 [Form] Update DateTime objects only if the actual value has changed (peterrehm) - * bug #10140 allow the TextAreaFormField to be used with valid/invalid HTML (dawehner) - * bug #10131 added lines to exceptions for the trans and transchoice tags (fabpot) - * bug #10119 [Validator] Minor fix in XmlFileLoader (florianv) - * bug #10078 [BrowserKit] add non-standard port to HTTP_HOST server param (kbond) - * bug #10091 [Translation] Update PluralizationRules.php (guilhermeblanco) - * bug #10053 [Form] fixed allow render 0 numeric input value (dczech) - * bug #10033 [HttpKernel] Bugfix - Logger Deprecation Notice (Rican7) - * bug #10023 [FrameworkBundle] Thrown an HttpException instead returning a Response in RedirectController::redirectAction() (jakzal) - * bug #9985 Prevent WDT from creating a session (mvrhov) - * bug #10000 [Console] Fixed the compatibility with HHVM (stof) - * bug #9979 [Doctrine Bridge][Validator] Fix for null values in assosiated properties when using UniqueEntityValidator (vpetrovych) - * bug #9983 [TwigBridge] Update min. version of Twig (stloyd) - * bug #9970 [CssSelector] fixed numeric attribute issue (jfsimon) - * bug #9747 [DoctrineBridge] Fix: Add type detection. Needed by pdo_dblib (iamluc) - * bug #9962 [Process] Fix #9861 : Revert TTY mode (romainneutron) - * bug #9960 [Form] Update minimal requirement in composer.json (stloyd) - * bug #9952 [Translator] Fix Empty translations with Qt files (vlefort) - * bug #9948 [WebProfilerBundle] Fixed profiler toolbar icons for XHTML. (rafalwrzeszcz) - * bug #9933 Propel1 exception message (jaugustin) - * bug #9949 [BrowserKit] Throw exception on invalid cookie expiration timestamp (anlutro) - -* 2.3.9 (2014-01-05) - - * bug #9938 [Process] Add support SAPI cli-server (peter-gribanov) - * bug #9940 [EventDispatcher] Fix hardcoded listenerTag name in error message (lemoinem) - * bug #9908 [HttpFoundation] Throw proper exception when invalid data is passed to JsonResponse class (stloyd) - * bug #9902 [Security] fixed pre/post authentication checks (fabpot) - * bug #9899 [Filesystem | WCM] 9339 fix stat on url for filesystem copy (cordoval) - * bug #9589 [DependencyInjection] Fixed #9020 - Added support for collections in service#parameters (lavoiesl) - * bug #9889 [Console] fixed column width when using the Table helper with some decoration in cells (fabpot) - * bug #9323 [DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support (bronze1man) - * bug #8997 [Security] Fixed problem with losing ROLE_PREVIOUS_ADMIN role. (pawaclawczyk) - * bug #9557 [DoctrineBridge] Fix for cache-key conflict when having a \Traversable as choices (DRvanR) - * bug #9879 [Security] Fix ExceptionListener to catch correctly AccessDeniedException if is not first exception (fabpot) - * bug #9885 [Dependencyinjection] Fixed handling of inlined references in the AnalyzeServiceReferencesPass (fabpot) - * bug #9884 [DomCrawler] Fixed creating form objects from named form nodes (jakzal) - * bug #9882 Add support for HHVM in the getting of the PHP executable (fabpot) - * bug #9850 [Validator] Fixed IBAN validator with 0750447346 value (stewe) - * bug #9865 [Validator] Fixes message value for objects (jongotlin) - * bug #9441 [Form][DateTimeToArrayTransformer] Check for hour, minute & second validity (egeloen) - * bug #9867 #9866 [Filesystem] Fixed mirror for symlinks (COil) - * bug #9806 [Security] Fix parent serialization of user object (ddeboer) - * bug #9834 [DependencyInjection] Fixed support for backslashes in service ids. (jakzal) - * bug #9826 fix #9356 [Security] Logger should manipulate the user reloaded from provider (matthieuauger) - * bug #9769 [BrowserKit] fixes #8311 CookieJar is totally ignorant of RFC 6265 edge cases (jzawadzki) - * bug #9697 [Config] fix 5528 let ArrayNode::normalizeValue respect order of value array provided (cordoval) - * bug #9701 [Config] fix #7243 allow 0 as arraynode name (cordoval) - * bug #9795 [Form] Fixed issue in BaseDateTimeTransformer when invalid timezone cause Trans... (tyomo4ka) - * bug #9714 [HttpFoundation] BinaryFileResponse should also return 416 or 200 on some range-requets (SimonSimCity) - * bug #9601 [Routing] Remove usage of deprecated _scheme requirement (Danez) - * bug #9489 [DependencyInjection] Add normalization to tag options (WouterJ) - * bug #9135 [Form] [Validator] fix maxLength guesser (franek) - * bug #9790 [Filesystem] Changed the mode for a target file in copy() to be write only (jakzal) - -* 2.3.8 (2013-12-16) - - * bug #9758 [Console] fixed TableHelper when cell value has new line (k-przybyszewski) - * bug #9760 [Routing] Fix router matching pattern against multiple hosts (karolsojko) - * bug #9674 [Form] rename validators.ua.xlf to validators.uk.xlf (craue) - * bug #9722 [Validator]Fixed getting wrong msg when value is an object in Exception (aitboudad) - * bug #9750 allow TraceableEventDispatcher to reuse event instance in nested events (evillemez) - * bug #9718 [validator] throw an exception if isn't an instance of ConstraintValidatorInterface. (aitboudad) - * bug #9716 Reset the box model to content-box in the web debug toolbar (stof) - * bug #9711 [FrameworkBundle] Allowed "0" as a checkbox value in php templates (jakzal) - * bug #9665 [Bridge/Doctrine] ORMQueryBuilderLoader - handled the scenario when no entity manager is passed with closure query builder (jakzal) - * bug #9656 [DoctrineBridge] normalized class names in the ORM type guesser (fabpot) - * bug #9647 use the correct class name to retrieve mapped class' metadata and reposi... (xabbuh) - * bug #9648 [Debug] ensured that a fatal PHP error is actually fatal after being handled by our error handler (fabpot) - * bug #9643 [WebProfilerBundle] Fixed js escaping in time.html.twig (hason) - * bug #9641 [Debug] Avoid notice from being "eaten" by fatal error. (fabpot) - * bug #9639 Modified guessDefaultEscapingStrategy to not escape txt templates (fabpot) - * bug #9314 [Form] Fix DateType for 32bits computers. (WedgeSama) - * bug #9443 [FrameworkBundle] Fixed the registration of validation.xml file when the form is disabled (hason) - * bug #9625 [HttpFoundation] Do not return an empty session id if the session was closed (Taluu) - * bug #9637 [Validator] Replaced inexistent interface (jakzal) - * bug #9605 Adjusting CacheClear Warmup method to namespaced kernels (rdohms) - * bug #9610 Container::camelize also takes backslashes into consideration (ondrejmirtes) - * bug #9447 [BrowserKit] fixed protocol-relative url redirection (jong99) - * bug #9535 No Entity Manager defined exception (armetiz) - * bug #9485 [Acl] Fix for issue #9433 (guilro) - * bug #9516 [AclProvider] Fix incorrect behavior when partial results returned from cache (superdav42) - * bug #9352 [Intl] make currency bundle merge fallback locales when accessing data, ... (shieldo) - * bug #9537 [FrameworkBundle] Fix mistake in translation's service definition. (phpmike) - * bug #9367 [Process] Check if the pipe array is empty before calling stream_select() (jfposton) - * bug #9211 [Form] Fixed memory leak in FormValidator (bschussek) - * bug #9469 [Propel1] re-factor Propel1 ModelChoiceList (havvg) - -* 2.3.7 (2013-11-14) - - * bug #9499 Request::overrideGlobals() may call invalid ini value (denkiryokuhatsuden) - * bug #9420 [Console][ProgressHelper] Fix ProgressHelper redraw when redrawFreq is greater than 1 (giosh94mhz) - * bug #9212 [Validator] Force Luhn Validator to only work with strings (Richtermeister) - * bug #9476 Fixed bug with lazy services (peterrehm) - * bug #9431 [DependencyInjection] fixed YamlDumper did not make services private. (realityking) - * bug #9416 fixed issue with clone now the children of the original form are preserved and the clone form is given new children (yjv) - * bug #9412 [HttpFoundation] added content length header to BinaryFileResponse (kbond) - * bug #9395 [HttpKernel] fixed memory limit display in MemoryDataCollector (hhamon) - * bug #9388 [Form] Fixed: The "data" option is taken into account even if it is NULL (bschussek) - * bug #9391 [Serializer] Fixed the error handling when decoding invalid XML to avoid a Warning (stof) - * bug #9378 [DomCrawler] [HttpFoundation] Make `Content-Type` attributes identification case-insensitive (matthieuprat) - * bug #9354 [Process] Fix #9343 : revert file handle usage on Windows platform (romainneutron) - * bug #9334 [Form] Improved FormTypeCsrfExtension to use the type class as default intention if the form name is empty (bschussek) - * bug #9333 [Form] Improved FormTypeCsrfExtension to use the type class as default intention if the form name is empty (bschussek) - * bug #9338 [DoctrineBridge] Added type check to prevent calling clear() on arrays (bschussek) - * bug #9328 [Form] Changed FormTypeCsrfExtension to use the form's name as default intention (bschussek) - * bug #9327 [Form] Changed FormTypeCsrfExtension to use the form's name as default intention (bschussek) - * bug #9308 [DoctrineBridge] Loosened CollectionToArrayTransformer::transform() to accept arrays (bschussek) - * bug #9274 [Yaml] Fixed the escaping of strings starting with a dash when dumping (stof) - * bug #9270 [Templating] Fix in ChainLoader.php (janschoenherr) - * bug #9246 [Session] fixed wrong started state (tecbot) - -* 2.3.6 (2013-10-10) - - * [Security] limited the password length passed to encoders - * bug #9259 [Process] Fix latest merge from 2.2 in 2.3 (romainneutron) - * bug #9237 [FrameworkBundle] assets:install command should mirror .dotfiles (.htaccess) (FineWolf) - * bug #9223 [Translator] PoFileDumper - PO headers (Padam87) - * bug #9257 [Process] Fix 9182 : random failure on pipes tests (romainneutron) - * bug #9222 [Bridge] [Propel1] Fixed guessed relations (ClementGautier) - * bug #9214 [FramworkBundle] Check event listener services are not abstract (lyrixx) - * bug #9207 [HttpKernel] Check for lock existence before unlinking (ollietb) - * bug #9184 Fixed cache warmup of paths which contain back-slashes (fabpot) - * bug #9192 [Form] remove MinCount and MaxCount constraints in ValidatorTypeGuesser (franek) - * bug #9190 Fix: duplicate usage of Symfony\Component\HttpFoundation\Response (realsim) - * bug #9188 [Form] add support for Length and Range constraint in ValidatorTypeGuesser (franek) - * bug #8809 [Form] enforce correct timezone (Burgov) - * bug #9169 Fixed client insulation when using the terminable event (fabpot) - * bug #9154 Fix problem with Windows file links (backslash in JavaScript string) (fabpot) - * bug #9153 [DependencyInjection] Prevented inlining of lazy loaded private service definitions (jakzal) - * bug #9103 [HttpFoundation] Header `HTTP_X_FORWARDED_PROTO` can contain various values (stloyd) - -* 2.3.5 (2013-09-27) - - * 8980954: bugix: CookieJar returns cookies with domain "domain.com" for domain "foodomain.com" - * bb59ac2: fixed HTML5 form attribute handling XPath query - * 3108c71: [Locale] added support for the position argument to NumberFormatter::parse() - * 0774c79: [Locale] added some more stubs for the number formatter - * e5282e8: [DomCrawler]Crawler guess charset from html - * 0e80d88: fixes RequestDataCollector bug, visible when used on Drupal8 - * c8d0342: [Console] fixed exception rendering when nested styles - * a47d663: [Console] fixed the formatter for single-char tags - * c6c35b3: [Console] Escape exception message during the rendering of an exception - * 04e730e: [DomCrawler] fixed HTML5 form attribute handling - * 0e437c5: [BrowserKit] Fixed the handling of parameters when redirecting - * d84df4c: [Process] Properly close pipes after a Process::stop call - * b3ae29d: fixed bytes conversion when used on 32-bits systems - * a273e79: [Form] Fixed: "required" attribute is not added to tag with "multiple" option - $builder->addViewTransformer(new ChoicesToValuesTransformer($options['choice_list'])); + $builder->addViewTransformer(new ChoicesToValuesTransformer($choiceList)); } else { //