From f24c8ab844ec2e9fec353fd59561779c2d7051d9 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Mon, 23 Mar 2015 22:11:47 +0100 Subject: [PATCH 01/29] =?UTF-8?q?[SecurityBundle]=C2=A0removed=20a=20dupli?= =?UTF-8?q?cated=20service=20definition=20and=20simplified=20others.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bundle/SecurityBundle/Resources/config/security.xml | 6 +++--- .../SecurityBundle/Resources/config/security_acl.xml | 8 ++++---- .../Resources/config/security_acl_dbal.xml | 2 -- .../Resources/config/security_listeners.xml | 9 +++++---- .../Resources/config/security_rememberme.xml | 5 ++--- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml index dd2a7fc30d..0e65fcfe15 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml @@ -71,17 +71,17 @@ - + - + - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml index 624b6b1d1d..d2e60b2511 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml @@ -13,13 +13,13 @@ Symfony\Component\Security\Acl\Domain\ObjectIdentityRetrievalStrategy Symfony\Component\Security\Acl\Domain\SecurityIdentityRetrievalStrategy - Symfony\Component\Security\Acl\Domain\DoctrineAclCache - + Symfony\Component\Security\Acl\Domain\AclCollectionCache + Symfony\Component\Security\Acl\Domain\DoctrineAclCache - + @@ -32,7 +32,7 @@ - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml index aac84a3ce5..b33709031a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml @@ -48,7 +48,5 @@ - - diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml index 7144f562f3..b7e4adfd2a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml @@ -76,7 +76,7 @@ - + @@ -88,7 +88,9 @@ + + @@ -109,7 +111,7 @@ - + @@ -130,8 +132,7 @@ - + abstract="true" /> diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml index eec67aa868..f430e04cd5 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml @@ -30,7 +30,7 @@ - + @@ -51,8 +51,7 @@ - + abstract="true" /> From 6eb5e7395cfb631240804319645b4592cf4fff8f Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Thu, 19 Mar 2015 17:40:41 +0000 Subject: [PATCH 02/29] [Translation] merge all fallback catalogues messages into current catalogue. --- .../Component/Translation/Translator.php | 73 ++++++++++++------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index fda8a33e40..001788479f 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -346,7 +346,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface /** * @param string $locale - * @param bool $forceRefresh + * @param bool $forceRefresh */ private function initializeCacheCatalogue($locale, $forceRefresh = false) { @@ -358,29 +358,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface $cache = new ConfigCache($this->cacheDir.'/catalogue.'.$locale.'.php', $this->debug); if ($forceRefresh || !$cache->isFresh()) { $this->initializeCatalogue($locale); - - $fallbackContent = ''; - $current = ''; - $replacementPattern = '/[^a-z0-9_]/i'; - foreach ($this->computeFallbackLocales($locale) as $fallback) { - $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback)); - $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current)); - - $fallbackContent .= sprintf(<<addFallbackCatalogue(\$catalogue%s); - - -EOF - , - $fallbackSuffix, - $fallback, - var_export($this->catalogues[$fallback]->all(), true), - $currentSuffix, - $fallbackSuffix - ); - $current = $fallback; - } + $fallbackContent = $this->getFallbackContent($this->catalogues[$locale]); $content = sprintf(<<catalogues[$locale] = $catalogue; } + private function getFallbackContent(MessageCatalogue $catalogue) + { + if (!$this->debug) { + // merge all fallback catalogues messages into $catalogue + $fallbackCatalogue = $catalogue->getFallbackCatalogue(); + $messages = $catalogue->all(); + while ($fallbackCatalogue) { + $messages = array_replace_recursive($fallbackCatalogue->all(), $messages); + $fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue(); + } + foreach ($messages as $domain => $domainMessages) { + $catalogue->add($domainMessages, $domain); + } + + return ''; + } + + $fallbackContent = ''; + $current = ''; + $replacementPattern = '/[^a-z0-9_]/i'; + $fallbackCatalogue = $catalogue->getFallbackCatalogue(); + while ($fallbackCatalogue) { + $fallback = $fallbackCatalogue->getLocale(); + $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback)); + $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current)); + + $fallbackContent .= sprintf(<<addFallbackCatalogue(\$catalogue%s); + +EOF + , + $fallbackSuffix, + $fallback, + var_export($fallbackCatalogue->all(), true), + $currentSuffix, + $fallbackSuffix + ); + $current = $fallbackCatalogue->getLocale(); + $fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue(); + } + + return $fallbackContent; + } + private function getResourcesHash($locale) { if (!isset($this->resources[$locale])) { From 78b1a6803a4181d6b0c252990a49c750cf2e7061 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Tue, 24 Mar 2015 18:40:46 +0100 Subject: [PATCH 03/29] fix typo --- src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php b/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php index 9d03aa7079..98c7fe3890 100644 --- a/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php +++ b/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php @@ -21,7 +21,7 @@ trigger_error('The '.__NAMESPACE__.'\AssetsExtension class is deprecated since v * * @author Fabien Potencier * - * @deprecated since 2.7, to be removed in 3.0. Use Symfony\Component\Twig\Extension\AssetExtension instead. + * @deprecated since 2.7, to be removed in 3.0. Use Symfony\Bridge\Twig\Extension\AssetExtension instead. */ class AssetsExtension extends \Twig_Extension { From 063ae13fdec4aa52e8a50fc3fe78a2929e93497c Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Tue, 24 Mar 2015 22:20:39 +0100 Subject: [PATCH 04/29] CS: general fixes --- .gitignore | 5 +++-- .php_cs | 22 +++++++++++++++++++ .../Form/choice_widget_collapsed.html.php | 4 ++-- .../views/Form/hidden_widget.html.php | 2 +- .../views/Form/integer_widget.html.php | 2 +- .../views/Form/number_widget.html.php | 2 +- .../views/Form/password_widget.html.php | 2 +- .../views/Form/percent_widget.html.php | 2 +- .../views/Form/search_widget.html.php | 2 +- .../Resources/views/Form/url_widget.html.php | 2 +- .../Resources/views/translation.html.php | 6 ++--- .../Factory/SecurityFactoryInterface.php | 2 +- .../Console/Tests/Helper/TableHelperTest.php | 2 +- .../DependencyInjection/Dumper/PhpDumper.php | 2 +- .../Tests/Fixtures/php/services1-1.php | 2 +- .../Tests/Fixtures/php/services1.php | 2 +- .../Tests/Fixtures/php/services10.php | 2 +- .../Tests/Fixtures/php/services11.php | 2 +- .../Tests/Fixtures/php/services12.php | 2 +- .../Tests/Fixtures/php/services8.php | 2 +- .../Tests/Fixtures/php/services9.php | 2 +- .../Tests/Fixtures/php/services9_compiled.php | 2 +- .../HttpFoundation/Tests/ParameterBagTest.php | 8 +++---- .../Tests/Collator/AbstractCollatorTest.php | 1 - .../Collator/Verification/CollatorTest.php | 1 - .../AbstractNumberFormatterTest.php | 1 - .../Matcher/Dumper/PhpMatcherDumper.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 2 +- .../Tests/Fixtures/dumper/url_matcher2.php | 2 +- .../Tests/Fixtures/dumper/url_matcher3.php | 2 +- .../Validator/ConstraintValidator.php | 16 +++++++------- 31 files changed, 64 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 418cb5f976..f16d739d03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -phpunit.xml +.php_cs.cache +autoload.php composer.lock composer.phar -autoload.php package*.tar packages.json +phpunit.xml /vendor/ diff --git a/.php_cs b/.php_cs index 3e4d9efb34..11d42d1287 100644 --- a/.php_cs +++ b/.php_cs @@ -3,4 +3,26 @@ return Symfony\CS\Config\Config::create() ->setUsingLinter(false) ->setUsingCache(true) + ->finder( + Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__) + ->exclude(array( + // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code + 'src/Symfony/Component/DependencyInjection/Tests/Fixtures', + 'src/Symfony/Component/Routing/Tests/Fixtures/dumper', + // fixture templates + 'src/Symfony/Component/Templating/Tests/Fixtures/templates', + // resource templates + 'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form', + )) + // file content autogenerated by `var_export` + ->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php') + // autogenerated xmls + ->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_1.xml') + ->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_2.xml') + // yml + ->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') + // test template + ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') + ) ; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_collapsed.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_collapsed.html.php index be78e46e8c..5d0897f195 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_collapsed.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_collapsed.html.php @@ -3,11 +3,11 @@ $required = false; endif; ?> block($form, 'widget_attributes', array( - 'required' => $required + 'required' => $required, )) ?> multiple="multiple" > - + 0): ?> block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?> 0 && null !== $separator): ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php index 68eec540e2..a43f7de475 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "hidden")) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php index 3775a71771..5fceb49a38 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "number")) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php index 854952f33f..324eb4782c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "text")) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php index 845fcb25c3..4390687a69 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "password")) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php index 35b9b0457f..59b29f4cbc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "text")) ?> % +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> % diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php index d91267fedc..4e442f6ef4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "search")) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php index c2ab28aa04..0ce4ed2ca7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : "url")) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php index 2167138a1e..04df261863 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php @@ -1,6 +1,6 @@ This template is used for translation message extraction tests trans('single-quoted key') ?> -trans("double-quoted key") ?> +trans('double-quoted key') ?> trans(<<trans( 'single-quoted key with whitespace and nonescaped \$\n\' sequences' ) ?> -trans( <<trans(<< -trans( <<<'EOF' +trans(<<<'EOF' nowdoc key with whitespace and nonescaped \$\n sequences EOF ) ?> diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php index 0d75129fb9..fce2f07580 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php @@ -26,7 +26,7 @@ interface SecurityFactoryInterface /** * Defines the position at which the provider is called. * Possible values: pre_auth, form, http, and remember_me. - * + * * @return string */ public function getPosition(); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php index e0d83cec61..392bffa3f6 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php @@ -112,7 +112,7 @@ TABLE array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), ), TableHelper::LAYOUT_BORDERLESS, - " =============== ========================== ================== \n ISBN Title Author \n =============== ========================== ================== \n 99921-58-10-7 Divine Comedy Dante Alighieri \n 9971-5-0210-0 A Tale of Two Cities Charles Dickens \n 960-425-059-0 The Lord of the Rings J. R. R. Tolkien \n 80-902734-1-6 And Then There Were None Agatha Christie \n =============== ========================== ================== \n" + " =============== ========================== ================== \n ISBN Title Author \n =============== ========================== ================== \n 99921-58-10-7 Divine Comedy Dante Alighieri \n 9971-5-0210-0 A Tale of Two Cities Charles Dickens \n 960-425-059-0 The Lord of the Rings J. R. R. Tolkien \n 80-902734-1-6 And Then There Were None Agatha Christie \n =============== ========================== ================== \n", ), array( array('ISBN', 'Title'), diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 83eea163c0..51d4c29291 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -761,7 +761,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; $bagClass /** - * $class + * $class. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index e83498f2c5..f01be2ea73 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; /** - * Container + * Container. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php index 90b59ff4eb..5497a7587a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index 43a56eec51..a33b08e3ab 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php index 23bae47920..5a2744f6f7 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index 3081abd6b0..f7acc1947a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php index 1b86dfc3f8..c2c52fe335 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index ecbd626abe..5d4733c1d6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 2e7e10480b..25b4835058 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; /** - * ProjectServiceContainer + * ProjectServiceContainer. * * This class has been auto-generated * by the Symfony Dependency Injection Component. diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index e7743c47a6..fdbab026b7 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -212,13 +212,13 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase $this->assertFalse($bag->filter('dec', '', false, FILTER_VALIDATE_INT, array( 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff)) - ), '->filter() gets a value of parameter as integer between boundaries'); + 'options' => array('min_range' => 1, 'max_range' => 0xff), + )), '->filter() gets a value of parameter as integer between boundaries'); $this->assertFalse($bag->filter('hex', '', false, FILTER_VALIDATE_INT, array( 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff)) - ), '->filter() gets a value of parameter as integer between boundaries'); + 'options' => array('min_range' => 1, 'max_range' => 0xff), + )), '->filter() gets a value of parameter as integer between boundaries'); $this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array'); } diff --git a/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php index 08f3a566cf..4f71c05e1d 100644 --- a/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php +++ b/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Intl\Tests\Collator; use Symfony\Component\Intl\Collator\Collator; -use Symfony\Component\Intl\Locale; /** * Test case for Collator implementations. diff --git a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php index c8dbc13151..5da56cc9af 100644 --- a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php +++ b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Intl\Tests\Collator\Verification; -use Symfony\Component\Intl\Locale; use Symfony\Component\Intl\Tests\Collator\AbstractCollatorTest; use Symfony\Component\Intl\Util\IntlTestHelper; diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 370e38c982..c172653d5b 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Intl\Tests\NumberFormatter; use Symfony\Component\Intl\Globals\IntlGlobals; -use Symfony\Component\Intl\Locale; use Symfony\Component\Intl\NumberFormatter\NumberFormatter; use Symfony\Component\Intl\Util\IntlTestHelper; diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index 0409484e5d..49d137f4ab 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -54,7 +54,7 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\RequestContext; /** - * {$options['class']} + * {$options['class']}. * * This class has been auto-generated * by the Symfony Routing Component. diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index fae9f51aa5..2ef0376666 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -5,7 +5,7 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\RequestContext; /** - * ProjectUrlMatcher + * ProjectUrlMatcher. * * This class has been auto-generated * by the Symfony Routing Component. diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index f58f3f8436..299e05c229 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -5,7 +5,7 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\RequestContext; /** - * ProjectUrlMatcher + * ProjectUrlMatcher. * * This class has been auto-generated * by the Symfony Routing Component. diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php index f2f642eb86..a615ad5fd3 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -5,7 +5,7 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\RequestContext; /** - * ProjectUrlMatcher + * ProjectUrlMatcher. * * This class has been auto-generated * by the Symfony Routing Component. diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php index 23a231eec3..5628b9dfce 100644 --- a/src/Symfony/Component/Validator/ConstraintValidator.php +++ b/src/Symfony/Component/Validator/ConstraintValidator.php @@ -24,14 +24,14 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface * Whether to format {@link \DateTime} objects as RFC-3339 dates * ("Y-m-d H:i:s"). * - * @var integer + * @var int */ const PRETTY_DATE = 1; /** * Whether to cast objects with a "__toString()" method to strings. * - * @var integer + * @var int */ const OBJECT_TO_STRING = 2; @@ -81,9 +81,9 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface * won't know what an "object", "array" or "resource" is and will be * confused by the violation message. * - * @param mixed $value The value to format as string - * @param integer $format A bitwise combination of the format - * constants in this class + * @param mixed $value The value to format as string + * @param int $format A bitwise combination of the format + * constants in this class * * @return string The string representation of the passed value */ @@ -141,9 +141,9 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface * Each of the values is converted to a string using * {@link formatValue()}. The values are then concatenated with commas. * - * @param array $values A list of values - * @param integer $format A bitwise combination of the format - * constants in this class + * @param array $values A list of values + * @param int $format A bitwise combination of the format + * constants in this class * * @return string The string representation of the value list * From ea8da6e09146c7eac35c678c19bafa731d184cf2 Mon Sep 17 00:00:00 2001 From: Ivan Kurnosov Date: Wed, 25 Mar 2015 17:29:41 +1300 Subject: [PATCH 05/29] StringUtils::equals() arguments in RememberMe Cookie based implementation are confused It must be the other way around --- .../Security/Http/RememberMe/TokenBasedRememberMeServices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php index 9042963b27..3fe39ac1d0 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php @@ -54,7 +54,7 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user))); } - if (true !== StringUtils::equals($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) { + if (true !== StringUtils::equals($this->generateCookieHash($class, $username, $expires, $user->getPassword()), $hash)) { throw new AuthenticationException('The cookie\'s hash is invalid.'); } From 56ed71c7d2b5a615c42074b0e3023aca0a1f4025 Mon Sep 17 00:00:00 2001 From: Scott Arciszewski Date: Thu, 19 Mar 2015 14:44:31 -0400 Subject: [PATCH 06/29] Update StringUtils.php --- .../Security/Core/Util/StringUtils.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index e8f3e3bb64..8cbd191a79 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -45,8 +45,8 @@ class StringUtils return hash_equals($knownString, $userInput); } - $knownLen = strlen($knownString); - $userLen = strlen($userInput); + $knownLen = self::safeStrlen($knownString); + $userLen = self::safeStrlen($userInput); // Extend the known string to avoid uninitialized string offsets $knownString .= $userInput; @@ -63,4 +63,18 @@ class StringUtils // They are only identical strings if $result is exactly 0... return 0 === $result; } + + /** + * Return the number of bytes in a string + * + * @param string $string The string whose length we wish to obtain + * @return int + */ + public static function safeStrlen($string) + { + if (function_exists('mb_strlen')) { + return mb_strlen($string, '8bit'); + } + return strlen($string); + } } From 7221efc0953a8fcfa8a34a7aff0fb9c7a0848223 Mon Sep 17 00:00:00 2001 From: Scott Arciszewski Date: Mon, 23 Mar 2015 06:31:32 -0400 Subject: [PATCH 07/29] Whitespace --- src/Symfony/Component/Security/Core/Util/StringUtils.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index 8cbd191a79..62dccd8a62 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -63,10 +63,10 @@ class StringUtils // They are only identical strings if $result is exactly 0... return 0 === $result; } - + /** * Return the number of bytes in a string - * + * * @param string $string The string whose length we wish to obtain * @return int */ @@ -75,6 +75,7 @@ class StringUtils if (function_exists('mb_strlen')) { return mb_strlen($string, '8bit'); } + return strlen($string); } } From 76b36d385f0f6cf7cb6e366b1b898f361ab38dc1 Mon Sep 17 00:00:00 2001 From: Scott Arciszewski Date: Mon, 23 Mar 2015 11:26:23 -0400 Subject: [PATCH 08/29] Update StringUtils.php --- src/Symfony/Component/Security/Core/Util/StringUtils.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index 62dccd8a62..861e94cb34 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -72,7 +72,14 @@ class StringUtils */ public static function safeStrlen($string) { - if (function_exists('mb_strlen')) { + // Premature optimization + // Since this cannot be changed at runtime, we can cache it + static $func_exists = null; + if ($func_exists === null) { + $func_exists = function_exists('mb_strlen'); + } + + if ($func_exists) { return mb_strlen($string, '8bit'); } From bdea4bad7f42aa5d8462b962e82433ef9df98028 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Mon, 23 Mar 2015 11:50:22 -0400 Subject: [PATCH 09/29] Prevent modifying secrets as much as possible --- .../Security/Core/Util/StringUtils.php | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index 861e94cb34..95c8513ed7 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -38,25 +38,29 @@ class StringUtils */ public static function equals($knownString, $userInput) { - $knownString = (string) $knownString; - $userInput = (string) $userInput; - if (function_exists('hash_equals')) { return hash_equals($knownString, $userInput); } + // Avoid making unnecessary duplications of secret data + if (!is_string($knownString)) { + $knownString = (string) $knownString; + } + + if (!is_string($userInput)) { + $userInput = (string) $userInput; + } + $knownLen = self::safeStrlen($knownString); $userLen = self::safeStrlen($userInput); - // Extend the known string to avoid uninitialized string offsets - $knownString .= $userInput; - // Set the result to the difference between the lengths $result = $knownLen - $userLen; - // Note that we ALWAYS iterate over the user-supplied length - // This is to mitigate leaking length information - for ($i = 0; $i < $userLen; $i++) { + // Always iterate over the minimum length possible. + $iterationLen = min($knownLen, $userLen); + + for ($i = 0; $i < $iterationLen; $i++) { $result |= (ord($knownString[$i]) ^ ord($userInput[$i])); } From 8269589c91c7a86bba31dd6ba69803adbb4a249e Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Mon, 23 Mar 2015 11:54:32 -0400 Subject: [PATCH 10/29] CS fixing --- src/Symfony/Component/Security/Core/Util/StringUtils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index 95c8513ed7..c43a41a1c7 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -82,7 +82,7 @@ class StringUtils if ($func_exists === null) { $func_exists = function_exists('mb_strlen'); } - + if ($func_exists) { return mb_strlen($string, '8bit'); } From 45cfb44df873a5b18d8b4973e0f4b0397adecaad Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Mon, 23 Mar 2015 15:15:15 -0400 Subject: [PATCH 11/29] Change behavior to mirror hash_equals() returning early if there is a length mismatch --- .../Security/Core/Util/StringUtils.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index c43a41a1c7..c44176a73e 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -38,10 +38,6 @@ class StringUtils */ public static function equals($knownString, $userInput) { - if (function_exists('hash_equals')) { - return hash_equals($knownString, $userInput); - } - // Avoid making unnecessary duplications of secret data if (!is_string($knownString)) { $knownString = (string) $knownString; @@ -51,16 +47,20 @@ class StringUtils $userInput = (string) $userInput; } + if (function_exists('hash_equals')) { + return hash_equals($knownString, $userInput); + } + $knownLen = self::safeStrlen($knownString); $userLen = self::safeStrlen($userInput); - // Set the result to the difference between the lengths - $result = $knownLen - $userLen; + if ($userLen != $knownLen) { + return false; + } - // Always iterate over the minimum length possible. - $iterationLen = min($knownLen, $userLen); + $result = 0; - for ($i = 0; $i < $iterationLen; $i++) { + for ($i = 0; $i < $knownLen; $i++) { $result |= (ord($knownString[$i]) ^ ord($userInput[$i])); } From 2c67400e521ac37513def39ee68c82d2afda6a60 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 25 Mar 2015 10:29:39 +0100 Subject: [PATCH 12/29] fixed CS --- .../Component/Security/Core/Util/StringUtils.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index c44176a73e..e68347f393 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -54,7 +54,7 @@ class StringUtils $knownLen = self::safeStrlen($knownString); $userLen = self::safeStrlen($userInput); - if ($userLen != $knownLen) { + if ($userLen !== $knownLen) { return false; } @@ -69,21 +69,22 @@ class StringUtils } /** - * Return the number of bytes in a string + * Returns the number of bytes in a string. * * @param string $string The string whose length we wish to obtain + * * @return int */ public static function safeStrlen($string) { // Premature optimization // Since this cannot be changed at runtime, we can cache it - static $func_exists = null; - if ($func_exists === null) { - $func_exists = function_exists('mb_strlen'); + static $funcExists = null; + if (null === $funcExists) { + $funcExists = function_exists('mb_strlen'); } - if ($func_exists) { + if ($funcExists) { return mb_strlen($string, '8bit'); } From e29f74e1148f516ce0633831dce2297aabf8d980 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 25 Mar 2015 09:01:24 +0100 Subject: [PATCH 13/29] [travis] Kill tests when a new commit has been pushed --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index fb8f8acbaa..8b821ac453 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ env: - SYMFONY_DEPRECATIONS_HELPER=weak before_install: + - if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then git fetch origin "refs/pull/$TRAVIS_PULL_REQUEST/merge"; else git fetch origin "$TRAVIS_BRANCH"; fi; + - if [[ "$TRAVIS_COMMIT" != `git rev-parse FETCH_HEAD` ]]; then echo "Pull request or branch commit hash has changed, aborting!"; exit 1; fi; - travis_retry sudo apt-get install parallel - composer self-update - if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then phpenv config-rm xdebug.ini; fi; From 51223d28c692be4747d3064f5648d08edddc74f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Egyed?= <1ed@mailbox.hu> Date: Wed, 25 Mar 2015 22:45:56 +0100 Subject: [PATCH 14/29] [WebProfilerBundle] Fixed collapsed profiler menu icons --- .../Resources/views/Profiler/layout.html.twig | 10 ++-------- .../Resources/views/Profiler/profiler.css.twig | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig index feb3396e2e..c03df2f393 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig @@ -46,7 +46,7 @@
  • - + Minimize @@ -63,9 +63,7 @@