From 6a217dcecc518a79f3251ce5461c6a60858098ac Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Wed, 23 Sep 2015 11:48:44 +0200 Subject: [PATCH 01/10] Use random_bytes function if it is available for random number generation --- .../Component/Security/Core/Util/SecureRandom.php | 12 ++++++++---- src/Symfony/Component/Security/composer.json | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Util/SecureRandom.php b/src/Symfony/Component/Security/Core/Util/SecureRandom.php index c0924df61f..3461b4ec37 100644 --- a/src/Symfony/Component/Security/Core/Util/SecureRandom.php +++ b/src/Symfony/Component/Security/Core/Util/SecureRandom.php @@ -42,12 +42,12 @@ final class SecureRandom implements SecureRandomInterface $this->seedFile = $seedFile; $this->logger = $logger; + $isUnsupportedPhp = '\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304; + // determine whether to use OpenSSL - if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304) { - $this->useOpenSsl = false; - } elseif (!function_exists('openssl_random_pseudo_bytes')) { + if (!function_exists('random_bytes') && ($isUnsupportedPhp || !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.'); + $this->logger->notice('It is recommended that you install the "paragonie/random_compat" library or enable the "openssl" extension for random number generation.'); } $this->useOpenSsl = false; } else { @@ -60,6 +60,10 @@ final class SecureRandom implements SecureRandomInterface */ public function nextBytes($nbBytes) { + if (function_exists('random_bytes')) { + return random_bytes($nbBytes); + } + // try OpenSSL if ($this->useOpenSsl) { $bytes = openssl_random_pseudo_bytes($nbBytes, $strong); diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index d18b644b09..2026fc4810 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -39,7 +39,8 @@ "symfony/validator": "", "symfony/routing": "", "doctrine/dbal": "to use the built-in ACL implementation", - "ircmaxell/password-compat": "" + "ircmaxell/password-compat": "", + "paragonie/random_compat": "" }, "autoload": { "psr-0": { "Symfony\\Component\\Security\\": "" } From 916519181617cfbfbc14f4cdbcfaa7517e3b97bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 25 Sep 2015 15:16:17 +0200 Subject: [PATCH 02/10] [Security] Allow user providers to be defined in many files --- .../SecurityBundle/DependencyInjection/MainConfiguration.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index c79868c523..439ce61046 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -321,7 +321,6 @@ class MainConfiguration implements ConfigurationInterface ), 'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')), )) - ->disallowNewKeysInSubsequentConfigs() ->isRequired() ->requiresAtLeastOneElement() ->useAttributeAsKey('name') From 3ba14604a735f460ba0bd819572d04e1319dec7b Mon Sep 17 00:00:00 2001 From: yethee Date: Sun, 20 Sep 2015 23:05:20 +0300 Subject: [PATCH 03/10] [FrameworkBundle] Advanced search templates of bundles It uses two different locations to search templates of bundle, as described in the documentation. --- .../Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php | 6 +++++- .../Tests/CacheWarmer/TemplateFinderTest.php | 3 ++- .../Fixtures/Resources/BaseBundle/views/base.format.engine | 0 .../BaseBundle/views/controller/custom.format.engine | 0 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/BaseBundle/views/base.format.engine create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/BaseBundle/views/controller/custom.format.engine diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php index 07f81f5878..2b756a2997 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php @@ -97,8 +97,12 @@ class TemplateFinder implements TemplateFinderInterface */ private function findTemplatesInBundle(BundleInterface $bundle) { - $templates = $this->findTemplatesInFolder($bundle->getPath().'/Resources/views'); $name = $bundle->getName(); + $templates = array_merge( + $this->findTemplatesInFolder($bundle->getPath().'/Resources/views'), + $this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views') + ); + $templates = array_unique($templates); foreach ($templates as $i => $template) { $templates[$i] = $template->set('bundle', $name); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php index 59a7d1d920..a417cdae3d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php @@ -46,10 +46,11 @@ class TemplateFinderTest extends TestCase $finder->findAllTemplates() ); - $this->assertCount(6, $templates, '->findAllTemplates() find all templates in the bundles and global folders'); + $this->assertCount(7, $templates, '->findAllTemplates() find all templates in the bundles and global folders'); $this->assertContains('BaseBundle::base.format.engine', $templates); $this->assertContains('BaseBundle::this.is.a.template.format.engine', $templates); $this->assertContains('BaseBundle:controller:base.format.engine', $templates); + $this->assertContains('BaseBundle:controller:custom.format.engine', $templates); $this->assertContains('::this.is.a.template.format.engine', $templates); $this->assertContains('::resource.format.engine', $templates); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/BaseBundle/views/base.format.engine b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/BaseBundle/views/base.format.engine new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/BaseBundle/views/controller/custom.format.engine b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/BaseBundle/views/controller/custom.format.engine new file mode 100644 index 0000000000..e69de29bb2 From c269d6feda63f65d023c207e7dec55dfa16899c8 Mon Sep 17 00:00:00 2001 From: Joshua Thijssen Date: Thu, 3 Sep 2015 15:22:43 +0200 Subject: [PATCH 04/10] Added exception when setAutoInitialize is called when locked --- src/Symfony/Component/Form/FormConfigBuilder.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index d8ebed7403..5bc2830116 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -855,6 +855,10 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ public function setAutoInitialize($initialize) { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + $this->autoInitialize = (bool) $initialize; return $this; From f181ea89e34a9290d848918f75c08c7c3c3372cd Mon Sep 17 00:00:00 2001 From: Diego Campoy Date: Tue, 1 Sep 2015 12:05:34 +0100 Subject: [PATCH 05/10] Fix phpdoc block of NativeSessionStorage class --- .../HttpFoundation/Session/Storage/NativeSessionStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index db705db87c..c8156ea7c5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -65,7 +65,7 @@ class NativeSessionStorage implements SessionStorageInterface * ("auto_start", is not supported as it tells PHP to start a session before * PHP starts to execute user-land code. Setting during runtime has no effect). * - * cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). + * cache_limiter, "" (use "0" to prevent headers from being sent entirely). * cookie_domain, "" * cookie_httponly, "" * cookie_lifetime, "0" From 12733cba00a0aa06f1458f28b80e24ccb7ec6841 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 26 Sep 2015 12:01:36 +0200 Subject: [PATCH 06/10] Forbid serializing a Crawler Unserializing a Crawler instance creates DOM elements in an invalid state, making the Crawler unusable. --- src/Symfony/Component/DomCrawler/Crawler.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 84ce8f3f8d..3bc2a456bd 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -311,6 +311,17 @@ class Crawler extends \SplObjectStorage } } + // Serializing and unserializing a crawler creates DOM objects in a corrupted state. DOM elements are not properly serializable. + public function unserialize($serialized) + { + throw new \BadMethodCallException('A Crawler cannot be serialized.'); + } + + public function serialize() + { + throw new \BadMethodCallException('A Crawler cannot be serialized.'); + } + /** * Returns a node given its position in the node list. * From b03bcb34ecfe81d7e1935eda13a8e7425d101d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Egyed?= <1ed@mailbox.hu> Date: Sat, 26 Sep 2015 13:59:49 +0200 Subject: [PATCH 07/10] Fix license headers --- ...egisterEventListenersAndSubscribersPassTest.php | 12 ++++++------ .../Form/ChoiceList/CompatModelChoiceListTest.php | 9 +++++++++ .../CacheClearCommand/CacheClearCommandTest.php | 9 +++++++++ .../Tests/Functional/app/Fragment/bundles.php | 9 +++++++++ .../Tests/Functional/app/Profiler/bundles.php | 9 +++++++++ .../Tests/Functional/app/Session/bundles.php | 9 +++++++++ .../DataCollector/SecurityDataCollectorTest.php | 9 +++++++++ .../Tests/Functional/app/CsrfFormLogin/bundles.php | 9 +++++++++ .../Functional/app/FirewallEntryPoint/bundles.php | 9 +++++++++ .../Functional/app/StandardFormLogin/bundles.php | 9 +++++++++ .../MergeExtensionConfigurationPassTest.php | 9 +++++++++ .../Iterator/RecursiveDirectoryIteratorTest.php | 12 ++++++------ .../ArrayToPartsTransformerTest.php | 2 +- .../BaseDateTimeTransformerTest.php | 2 +- .../ValueToDuplicatesTransformerTest.php | 2 +- .../Tests/Extension/Core/Type/TypeTestCase.php | 2 +- .../Extension/Validator/Type/TypeTestCase.php | 2 +- .../Validator/ValidatorTypeGuesserTest.php | 14 +++++++------- .../HttpKernel/Tests/Bundle/BundleTest.php | 2 +- .../Component/Process/Tests/NonStopableProcess.php | 9 +++++++++ .../Tests/PipeStdinInStdoutStdErrStreamSelect.php | 9 +++++++++ .../Component/Process/Tests/SignalListener.php | 9 +++++++++ .../Tests/PropertyPathBuilderTest.php | 2 +- .../Mapping/Loader/AbstractStaticMethodLoader.php | 9 +++++++++ 24 files changed, 152 insertions(+), 26 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php index 13573978b5..2643819f3d 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php @@ -2,12 +2,12 @@ /* * This file is part of the Symfony package. -* -* (c) Fabien Potencier -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass; diff --git a/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/CompatModelChoiceListTest.php b/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/CompatModelChoiceListTest.php index bb61786592..2148330ea2 100644 --- a/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/CompatModelChoiceListTest.php +++ b/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/CompatModelChoiceListTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bridge\Propel1\Tests\Form\ChoiceList; use Symfony\Bridge\Propel1\Form\ChoiceList\ModelChoiceList; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index 78ab561df1..cb8d1cc6ea 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand; use Symfony\Bundle\FrameworkBundle\Console\Application; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/bundles.php index 351cf79d43..a73987bcc9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/bundles.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/bundles.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Profiler/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Profiler/bundles.php index 351cf79d43..a73987bcc9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Profiler/bundles.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Profiler/bundles.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/bundles.php index 351cf79d43..a73987bcc9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/bundles.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/bundles.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php index f455d24840..8127233aaf 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\SecurityBundle\Tests\DataCollector; use Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/bundles.php index cee883f9cb..c16ab12f65 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/bundles.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/bundles.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + return array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php index c6fd207dd1..412e1c5d09 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + return array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/bundles.php index e4bbc08f73..d53ff3e7eb 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/bundles.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/bundles.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\FormLoginBundle; use Symfony\Bundle\TwigBundle\TwigBundle; use Symfony\Bundle\SecurityBundle\SecurityBundle; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index c16c4c5570..0bc96a3cc9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\DependencyInjection\Tests\Compiler; use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass; diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php index 61242eab38..92c00b2ed9 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -2,12 +2,12 @@ /* * This file is part of the Symfony package. -* -* (c) Fabien Potencier -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Symfony\Component\Finder\Tests\Iterator; diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php index bafe5c098f..33779260ae 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php @@ -3,7 +3,7 @@ /* * This file is part of the Symfony package. * - * (c) Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php index 8f2d16bb1b..7eb716b6d3 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTest.php @@ -3,7 +3,7 @@ /* * This file is part of the Symfony package. * - * (c) Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php index 6dc9785c24..eb3cf9704b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php @@ -3,7 +3,7 @@ /* * This file is part of the Symfony package. * - * (c) Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php index 733546e382..d7c27552e9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php @@ -3,7 +3,7 @@ /* * This file is part of the Symfony package. * - * (c) Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php index f197b19857..8ace4d3c3b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php @@ -3,7 +3,7 @@ /* * This file is part of the Symfony package. * - * (c) Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php index 654f6d5d2f..bd065eeb45 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php @@ -1,13 +1,13 @@ -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * 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\Validator; diff --git a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index c9059a74a1..26dae365db 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -3,7 +3,7 @@ /* * This file is part of the Symfony package. * - * (c) Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Symfony/Component/Process/Tests/NonStopableProcess.php b/src/Symfony/Component/Process/Tests/NonStopableProcess.php index 692feebba2..54510c16a3 100644 --- a/src/Symfony/Component/Process/Tests/NonStopableProcess.php +++ b/src/Symfony/Component/Process/Tests/NonStopableProcess.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * Runs a PHP script that can be stopped only with a SIGKILL (9) signal for 3 seconds. * diff --git a/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php b/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php index 26673ea45a..bbd7ddfeb2 100644 --- a/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php +++ b/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + define('ERR_SELECT_FAILED', 1); define('ERR_TIMEOUT', 2); define('ERR_READ_FAILED', 3); diff --git a/src/Symfony/Component/Process/Tests/SignalListener.php b/src/Symfony/Component/Process/Tests/SignalListener.php index bd4d138b04..4206550f5b 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + // required for signal handling declare (ticks = 1); diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php index 5955049246..3767e08c82 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php @@ -1,7 +1,7 @@ * diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php index 08f219d0a4..d032f0e8ca 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Validator\Tests\Mapping\Loader; use Symfony\Component\Validator\Mapping\ClassMetadata; From 51147e3aff9b3e8637214778f3f88754da93f0a1 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 26 Sep 2015 17:47:39 +0200 Subject: [PATCH 08/10] Add a group for tests of the finder against the FTP server This allows to skip them easily when running the testsuite, as they represent a significant part of the testsuite time. --- .../RecursiveDirectoryIteratorTest.php | 46 ++++++------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php index 92c00b2ed9..b59d0d6f27 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -16,42 +16,36 @@ use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; class RecursiveDirectoryIteratorTest extends IteratorTestCase { /** - * @dataProvider getPaths - * - * @param string $path - * @param bool $seekable - * @param bool $contains - * @param string $message + * @group network */ - public function testRewind($path, $seekable, $contains, $message = null) + public function testRewindOnFtp() { try { - $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); + $i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS); } catch (\UnexpectedValueException $e) { - $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path)); + $this->markTestSkipped('Unsupported stream "ftp".'); } $i->rewind(); - $this->assertTrue(true, $message); + $this->assertTrue(true); } /** - * @dataProvider getPaths - * - * @param string $path - * @param bool $seekable - * @param bool $contains - * @param string $message + * @group network */ - public function testSeek($path, $seekable, $contains, $message = null) + public function testSeekOnFtp() { try { - $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); + $i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS); } catch (\UnexpectedValueException $e) { - $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path)); + $this->markTestSkipped('Unsupported stream "ftp".'); } + $contains = array( + 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README', + 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub', + ); $actual = array(); $i->seek(0); @@ -62,18 +56,4 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase $this->assertEquals($contains, $actual); } - - public function getPaths() - { - $data = array(); - - // ftp - $contains = array( - 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README', - 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub', - ); - $data[] = array('ftp://ftp.mozilla.org/', false, $contains); - - return $data; - } } From 12743d10359841c28204a4c561df159b511c5552 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 26 Sep 2015 13:46:24 +0200 Subject: [PATCH 09/10] Detect Mintty for color support on Windows Mintty is now the default terminal in GitBash, and it supports ANSI colors without the need of ANSICON (it even supports 256 colors rather than the 16 colors supported by ANSICON). --- src/Symfony/Component/Console/Output/StreamOutput.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 86fe1827e9..70623681dc 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -89,7 +89,7 @@ class StreamOutput extends Output * * Colorization is disabled if not supported by the stream: * - * - Windows without Ansicon and ConEmu + * - Windows without Ansicon, ConEmu or Mintty * - non tty consoles * * @return bool true if the stream supports colorization, false otherwise @@ -98,7 +98,7 @@ class StreamOutput extends Output { // @codeCoverageIgnoreStart if (DIRECTORY_SEPARATOR === '\\') { - return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } return function_exists('posix_isatty') && @posix_isatty($this->stream); From ea2bd2a0a2da17a36c277123722b3e49be67789d Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 26 Sep 2015 13:46:24 +0200 Subject: [PATCH 10/10] Detect Mintty for color support on Windows Mintty is now the default terminal in GitBash, and it supports ANSI colors without the need of ANSICON (it even supports 256 colors rather than the 16 colors supported by ANSICON). --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- src/Symfony/Component/VarDumper/Dumper/CliDumper.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 42d88b030d..063723d32d 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -133,7 +133,7 @@ class DeprecationErrorHandler private static function hasColorSupport() { if ('\\' === DIRECTORY_SEPARATOR) { - return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 1fcad90c87..cbdef90dd4 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -448,7 +448,7 @@ class CliDumper extends AbstractDumper } if ('\\' === DIRECTORY_SEPARATOR) { - static::$defaultColors = @(false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI')); + static::$defaultColors = @(false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM')); } elseif (function_exists('posix_isatty')) { $h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null); $h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;