From 6d2135b65c2e70870d0f7bf2856f8208e3c83dbd Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Wed, 15 May 2013 18:33:29 +0200 Subject: [PATCH 01/33] force the Content-Type to html in the web profiler controllers --- .../Controller/ExceptionController.php | 6 ++-- .../Controller/ProfilerController.php | 32 +++++++++---------- .../Controller/RouterController.php | 4 +-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index 64108d58ad..6d10ab641b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -50,7 +50,7 @@ class ExceptionController if (!$this->twig->getLoader()->exists($template)) { $handler = new ExceptionHandler(); - return new Response($handler->getContent($exception)); + return new Response($handler->getContent($exception), 200, array('Content-Type' => 'text/html')); } $code = $exception->getStatusCode(); @@ -64,7 +64,7 @@ class ExceptionController 'logger' => null, 'currentContent' => '', ) - )); + ), 200, array('Content-Type' => 'text/html')); } /** @@ -87,7 +87,7 @@ class ExceptionController return new Response($handler->getStylesheet($exception)); } - return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig')); + return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, 'text/css'); } protected function getTemplate() diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 1b2d8ded1f..4b0ba07ce9 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -61,7 +61,7 @@ class ProfilerController { $this->profiler->disable(); - return new RedirectResponse($this->generator->generate('_profiler_search_results', array('token' => 'empty', 'limit' => 10))); + return new RedirectResponse($this->generator->generate('_profiler_search_results', array('token' => 'empty', 'limit' => 10)), 302, array('Content-Type' => 'text/html')); } /** @@ -82,7 +82,7 @@ class ProfilerController $page = $request->query->get('page', 'home'); if (!$profile = $this->profiler->loadProfile($token)) { - return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token))); + return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html')); } if (!$profile->hasCollector($panel)) { @@ -98,7 +98,7 @@ class ProfilerController 'request' => $request, 'templates' => $this->getTemplateManager()->getTemplates($profile), 'is_ajax' => $request->isXmlHttpRequest(), - ))); + )), 200, array('Content-Type' => 'text/html')); } /** @@ -134,7 +134,7 @@ class ProfilerController $this->profiler->disable(); $this->profiler->purge(); - return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'purge'))); + return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'purge')), 302, array('Content-Type' => 'text/html')); } /** @@ -151,14 +151,14 @@ class ProfilerController $file = $request->files->get('file'); if (empty($file) || !$file->isValid()) { - return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'upload_error'))); + return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'upload_error')), 302, array('Content-Type' => 'text/html')); } if (!$profile = $this->profiler->import(file_get_contents($file->getPathname()))) { - return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'already_exists'))); + return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'already_exists')), 302, array('Content-Type' => 'text/html')); } - return new RedirectResponse($this->generator->generate('_profiler', array('token' => $profile->getToken()))); + return new RedirectResponse($this->generator->generate('_profiler', array('token' => $profile->getToken())), 302, array('Content-Type' => 'text/html')); } /** @@ -174,7 +174,7 @@ class ProfilerController return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array( 'about' => $about - ))); + )), 200, array('Content-Type' => 'text/html')); } /** @@ -195,13 +195,13 @@ class ProfilerController } if (null === $token) { - return new Response(); + return new Response('', 200, array('Content-Type' => 'text/html')); } $this->profiler->disable(); if (!$profile = $this->profiler->loadProfile($token)) { - return new Response(); + return new Response('', 200, array('Content-Type' => 'text/html')); } // the toolbar position (top, bottom, normal, or null -- use the configuration) @@ -222,7 +222,7 @@ class ProfilerController 'templates' => $this->getTemplateManager()->getTemplates($profile), 'profiler_url' => $url, 'token' => $token, - ))); + )), 200, array('Content-Type' => 'text/html')); } /** @@ -262,7 +262,7 @@ class ProfilerController 'start' => $start, 'end' => $end, 'limit' => $limit, - ))); + )), 200, array('Content-Type' => 'text/html')); } /** @@ -297,7 +297,7 @@ class ProfilerController 'end' => $end, 'limit' => $limit, 'panel' => null, - ))); + )), 200, array('Content-Type' => 'text/html')); } /** @@ -330,7 +330,7 @@ class ProfilerController } if (!empty($token)) { - return new RedirectResponse($this->generator->generate('_profiler', array('token' => $token))); + return new RedirectResponse($this->generator->generate('_profiler', array('token' => $token)), 302, array('Content-Type' => 'text/html')); } $tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end); @@ -343,7 +343,7 @@ class ProfilerController 'start' => $start, 'end' => $end, 'limit' => $limit, - ))); + )), 302, array('Content-Type' => 'text/html')); } /** @@ -359,7 +359,7 @@ class ProfilerController phpinfo(); $phpinfo = ob_get_clean(); - return new Response($phpinfo); + return new Response($phpinfo, 200, array('Content-Type' => 'text/html')); } /** diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php index 430b387388..1ff9961679 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php @@ -53,7 +53,7 @@ class RouterController $this->profiler->disable(); if (null === $this->matcher || null === $this->routes) { - return new Response('The Router is not enabled.'); + return new Response('The Router is not enabled.', 200, array('Content-Type' => 'text/html')); } $profile = $this->profiler->loadProfile($token); @@ -68,6 +68,6 @@ class RouterController 'request' => $request, 'router' => $profile->getCollector('router'), 'traces' => $matcher->getTraces($request->getPathInfo()), - ))); + )), 200, array('Content-Type' => 'text/html')); } } From 849f3ed7e92e04a1f72346769931deecddd4d67d Mon Sep 17 00:00:00 2001 From: alquerci Date: Mon, 10 Jun 2013 20:35:46 +0200 Subject: [PATCH 02/33] [Finder] Fix SplFileInfo::getContents isn't working with ssh2 protocol --- src/Symfony/Component/Finder/SplFileInfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Finder/SplFileInfo.php b/src/Symfony/Component/Finder/SplFileInfo.php index e7e58f757c..d911fe06e8 100644 --- a/src/Symfony/Component/Finder/SplFileInfo.php +++ b/src/Symfony/Component/Finder/SplFileInfo.php @@ -65,7 +65,7 @@ class SplFileInfo extends \SplFileInfo public function getContents() { $level = error_reporting(0); - $content = file_get_contents($this->getRealpath()); + $content = file_get_contents($this->getPathname()); error_reporting($level); if (false === $content) { $error = error_get_last(); From 0c0a3e90e79b63215707ae7e92193f511cc0ec77 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Jun 2013 09:34:22 +0200 Subject: [PATCH 03/33] [Console] fixed regression when calling a command foo:bar if there is another one like foo:bar:baz (closes #8245) --- src/Symfony/Component/Console/Application.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index d4ad03a02f..9b2a9b63c8 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -573,6 +573,10 @@ class Application return $this->get($abbrevs[$searchName][0]); } + if (isset($abbrevs[$searchName]) && in_array($searchName, $abbrevs[$searchName])) { + return $this->get($searchName); + } + if (isset($abbrevs[$searchName]) && count($abbrevs[$searchName]) > 1) { $suggestions = $this->getAbbreviationSuggestions($abbrevs[$searchName]); From de289d2cfd173ef802e2ca72151422c9b79ff0c8 Mon Sep 17 00:00:00 2001 From: Douglas Greenshields Date: Tue, 11 Jun 2013 12:21:03 +0100 Subject: [PATCH 04/33] [Form] corrected interface bind() method defined against in deprecation notice --- src/Symfony/Component/Form/Form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index f1c8e5cc60..55d80c2f9f 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -649,11 +649,11 @@ class Form implements \IteratorAggregate, FormInterface * @throws FormException if the method of the request is not one of GET, POST or PUT * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use - * {@link FormConfigInterface::bind()} instead. + * {@link FormInterface::bind()} instead. */ public function bindRequest(Request $request) { - trigger_error('bindRequest() is deprecated since version 2.1 and will be removed in 2.3. Use FormConfigInterface::bind() instead.', E_USER_DEPRECATED); + trigger_error('bindRequest() is deprecated since version 2.1 and will be removed in 2.3. Use FormInterface::bind() instead.', E_USER_DEPRECATED); return $this->bind($request); } From a2f6a41dd6541d442aa22ed4e77a0a0ea2f2bc9e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Jun 2013 13:46:15 +0200 Subject: [PATCH 05/33] updated CHANGELOG for 2.3.1 --- CHANGELOG-2.3.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index 2617dfb023..1392c6d1df 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,19 @@ 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.1 (2013-06-11) + + * 25e3abd: fix many-to-many Propel1 ModelChoiceList + * bce6bd2: [DomCrawler] Fixed a fatal error when setting a value in a malformed field name. + * e3561ce: [FrameworkBundle] Fixed OutOfBoundException when session handler_id is null + * 81b122d: [DependencyInjection] Add support for aliases of aliases + regression test + * 445b2e3: [Console] fix status code when Exception::getCode returns something like 0.1 + * bbfde62: Fixed exit code for exceptions with error code 0 + * d8c0ef7: [DependencyInjection] Rename ContainerBuilder::$aliases to avoid conflicting with the parent class + * bb797ee: [DependencyInjection] Remove get*Alias*Service methods from compiled containers + * 379f5e0: [DependencyInjection] Fix aliased access of shared services, fixes #8096 + * afad9c7: instantiate valid commands only + * 2.3.0 (2013-06-03) * e93fc7a: [FrameworkBundle] set the dispatcher in the console application From 0902c606b4df1161f5b786ae89f37b71380b1f23 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Jun 2013 13:46:38 +0200 Subject: [PATCH 06/33] updated VERSION for 2.3.1 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 80a5a3a64f..644d47b3ed 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $loadClassCache; - const VERSION = '2.3.1-DEV'; + const VERSION = '2.3.1'; const VERSION_ID = '20301'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; const RELEASE_VERSION = '1'; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From 8d29c64dcc7457ebaaabfea8b05f4a035abdbebe Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Jun 2013 15:34:17 +0200 Subject: [PATCH 07/33] bumped Symfony version to 2.3.2-DEV-DEV --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 644d47b3ed..6215063af8 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $loadClassCache; - const VERSION = '2.3.1'; - const VERSION_ID = '20301'; + const VERSION = '2.3.2-DEV'; + const VERSION_ID = '20302'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; - const RELEASE_VERSION = '1'; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = '2'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From aa79393054d1ddc7684f4ec3e0132a6a83d670ad Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Wed, 12 Jun 2013 12:05:49 +0200 Subject: [PATCH 08/33] also consider alias in Container::has() --- src/Symfony/Component/DependencyInjection/Container.php | 6 +++++- .../DependencyInjection/Tests/ContainerTest.php | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index ef561e1ded..b97f8a2c03 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -88,6 +88,7 @@ class Container implements IntrospectableContainerInterface $this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag; $this->services = array(); + $this->aliases = array(); $this->scopes = array(); $this->scopeChildren = array(); $this->scopedServices = array(); @@ -228,7 +229,10 @@ class Container implements IntrospectableContainerInterface { $id = strtolower($id); - return array_key_exists($id, $this->services) || method_exists($this, 'get'.strtr($id, array('_' => '', '.' => '_')).'Service'); + return array_key_exists($id, $this->services) + || array_key_exists($id, $this->aliases) + || method_exists($this, 'get'.strtr($id, array('_' => '', '.' => '_')).'Service') + ; } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index f49a567f52..c87f2c2b9a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -477,6 +477,14 @@ class ContainerTest extends \PHPUnit_Framework_TestCase return $reflection->getValue($obj); } + + public function testAlias() + { + $c = new ProjectServiceContainer(); + + $this->assertTrue($c->has('alias')); + $this->assertSame($c->get('alias'), $c->get('bar')); + } } class ProjectServiceContainer extends Container @@ -490,6 +498,7 @@ class ProjectServiceContainer extends Container $this->__bar = new \stdClass(); $this->__foo_bar = new \stdClass(); $this->__foo_baz = new \stdClass(); + $this->aliases = array('alias' => 'bar'); } protected function getScopedService() From e65723c0007c78659aa5a3f72b42b3eaeb5c92ba Mon Sep 17 00:00:00 2001 From: Antonio Angelino Date: Wed, 12 Jun 2013 16:52:32 +0200 Subject: [PATCH 09/33] fix-progressbar-start lastMessagesLength and barCharOriginal should be reset if you want to use 2 or more Progress Bars in the same command flow. --- src/Symfony/Component/Console/Helper/ProgressHelper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Console/Helper/ProgressHelper.php b/src/Symfony/Component/Console/Helper/ProgressHelper.php index 4ed92cfab3..8b42b352a1 100644 --- a/src/Symfony/Component/Console/Helper/ProgressHelper.php +++ b/src/Symfony/Component/Console/Helper/ProgressHelper.php @@ -186,6 +186,8 @@ class ProgressHelper extends Helper $this->current = 0; $this->max = (int) $max; $this->output = $output; + $this->lastMessagesLength = 0; + $this->barCharOriginal = ''; if (null === $this->format) { switch ($output->getVerbosity()) { From 41399360e8ae8deb07ff49ea4ed2ea5b2abec3d9 Mon Sep 17 00:00:00 2001 From: Dmitrii Chekaliuk Date: Thu, 13 Jun 2013 02:54:36 +0300 Subject: [PATCH 10/33] [DomCrawler] Fix handling file:// without a host --- src/Symfony/Component/DomCrawler/Link.php | 2 +- src/Symfony/Component/DomCrawler/Tests/LinkTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DomCrawler/Link.php b/src/Symfony/Component/DomCrawler/Link.php index 3a65148354..838e5f9023 100644 --- a/src/Symfony/Component/DomCrawler/Link.php +++ b/src/Symfony/Component/DomCrawler/Link.php @@ -120,7 +120,7 @@ class Link return $baseUri.$uri; } - $baseUri = preg_replace('#^(.*?//[^/]+)(?:\/.*)?$#', '$1', $this->currentUri); + $baseUri = preg_replace('#^(.*?//[^/]*)(?:\/.*)?$#', '$1', $this->currentUri); // absolute path if ('/' === $uri[0]) { diff --git a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php index c1d6268a12..be1c22c3f4 100644 --- a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php @@ -118,6 +118,11 @@ class LinkTest extends \PHPUnit_Framework_TestCase array('../bar/./../../foo', 'http://localhost/bar/foo/', 'http://localhost/foo'), array('../../', 'http://localhost/', 'http://localhost/'), array('../../', 'http://localhost', 'http://localhost/'), + + array('/foo', 'file:///', 'file:///foo'), + array('/foo', 'file:///bar/baz', 'file:///foo'), + array('foo', 'file:///', 'file:///foo'), + array('foo', 'file:///bar/baz', 'file:///bar/foo'), ); } } From 8764944c69d3afbd0ee19d2b200f4f1f28211ee4 Mon Sep 17 00:00:00 2001 From: Matthew J Mucklo Date: Fri, 7 Jun 2013 14:35:54 -0700 Subject: [PATCH 11/33] fix issue where $_ENV contains array vals There are cases where $env or $_ENV can contain a value that is an array This will cause Process to throw an Array to String conversion exception Initially I submitted a patch of Process.php, however Fabien indicated that it shouldn't be fixed there (see below pull request). Before recently, a simple work around would be in php.ini to set: register_argc_argv = On However with recent changes, this seems to no longer work. Original pull request: https://github.com/symfony/symfony/pull/7354 See ticket https://github.com/symfony/symfony/issues/7196 --- src/Symfony/Component/Process/ProcessBuilder.php | 3 +++ .../Process/Tests/ProcessBuilderTest.php | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Symfony/Component/Process/ProcessBuilder.php b/src/Symfony/Component/Process/ProcessBuilder.php index c4ef31d311..151340d336 100644 --- a/src/Symfony/Component/Process/ProcessBuilder.php +++ b/src/Symfony/Component/Process/ProcessBuilder.php @@ -151,6 +151,9 @@ class ProcessBuilder $env = $this->env; } + // Process can not handle env values that are arrays + $env = $env ? array_filter($env, function ($value) { if (!is_array($value)) { return true; } }) : $env; + return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options); } } diff --git a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php index 53e403605b..1d46d71a57 100644 --- a/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php @@ -45,6 +45,22 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase $_ENV = $snapshot; } + public function testProcessBuilderShouldNotPassEnvArrays() + { + $snapshot = $_ENV; + $_ENV = array('a' => array('b', 'c'), 'd' => 'e', 'f' => 'g'); + $expected = array('d' => 'e', 'f' => 'g'); + + $pb = new ProcessBuilder(); + $pb->add('a')->inheritEnvironmentVariables() + ->setEnv('d', 'e'); + $proc = $pb->getProcess(); + + $this->assertEquals($expected, $proc->getEnv(), '->inheritEnvironmentVariables() removes array values from $_ENV'); + + $_ENV = $snapshot; + } + public function testInheritEnvironmentVarsByDefault() { $pb = new ProcessBuilder(); From 0991cd0b9df3158a23d8a95e2981e3cac3db74fc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 13 Jun 2013 08:50:29 +0200 Subject: [PATCH 12/33] [Process] moved env check to the Process class (refs #8227) --- src/Symfony/Component/Process/Process.php | 19 ++++++++++++++----- .../Component/Process/ProcessBuilder.php | 3 --- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index ac92467574..ed4cccff3c 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -145,10 +145,7 @@ class Process $this->cwd = getcwd(); } if (null !== $env) { - $this->env = array(); - foreach ($env as $key => $value) { - $this->env[(binary) $key] = (binary) $value; - } + $this->setEnv($env); } else { $this->env = null; } @@ -890,13 +887,25 @@ class Process /** * Sets the environment variables. * + * An environment variable value should be a string. + * If it is an array, the variable is ignored. + * + * That happens in PHP when 'argv' is registered into + * the $_ENV array for instance. + * * @param array $env The new environment variables * * @return self The current Process instance */ public function setEnv(array $env) { - $this->env = $env; + // Process can not handle env values that are arrays + $env = array_filter($env, function ($value) { if (!is_array($value)) { return true; } }); + + $this->env = array(); + foreach ($env as $key => $value) { + $this->env[(binary) $key] = (binary) $value; + } return $this; } diff --git a/src/Symfony/Component/Process/ProcessBuilder.php b/src/Symfony/Component/Process/ProcessBuilder.php index 151340d336..c4ef31d311 100644 --- a/src/Symfony/Component/Process/ProcessBuilder.php +++ b/src/Symfony/Component/Process/ProcessBuilder.php @@ -151,9 +151,6 @@ class ProcessBuilder $env = $this->env; } - // Process can not handle env values that are arrays - $env = $env ? array_filter($env, function ($value) { if (!is_array($value)) { return true; } }) : $env; - return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options); } } From 842f3fa3d28d72910059d83e268a708a9005035d Mon Sep 17 00:00:00 2001 From: Tom Maguire Date: Mon, 10 Jun 2013 14:35:49 +0100 Subject: [PATCH 13/33] do not re-register commands each time a Console\Application is run --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index e478c51723..6df31ae69b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -27,6 +27,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; class Application extends BaseApplication { private $kernel; + private $commandsRegistered = false; /** * Constructor. @@ -65,7 +66,9 @@ class Application extends BaseApplication */ public function doRun(InputInterface $input, OutputInterface $output) { - $this->registerCommands(); + if (!$this->commandsRegistered) { + $this->registerCommands(); + } if (true === $input->hasParameterOption(array('--shell', '-s'))) { $shell = new Shell($this); @@ -87,5 +90,7 @@ class Application extends BaseApplication $bundle->registerCommands($this); } } + + $this->commandsRegistered = true; } } From 24a07fbab80ca7cd655f793a1f7fedcb0f92c3b8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 13 Jun 2013 09:07:59 +0200 Subject: [PATCH 14/33] [FrameworkBundle] tweaked previous merge (refs #8242) --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 6df31ae69b..695c819015 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -68,6 +68,8 @@ class Application extends BaseApplication { if (!$this->commandsRegistered) { $this->registerCommands(); + + $this->commandsRegistered = true; } if (true === $input->hasParameterOption(array('--shell', '-s'))) { @@ -90,7 +92,5 @@ class Application extends BaseApplication $bundle->registerCommands($this); } } - - $this->commandsRegistered = true; } } From b5ded812fe2f327eb54828f5040c521bfc3c5525 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 13 Jun 2013 09:21:46 +0200 Subject: [PATCH 15/33] [Security] fixed usage of the salt for the bcrypt encoder (refs #8210) --- .../Security/Core/Encoder/BCryptPasswordEncoder.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php index 3609f64b81..a355421580 100644 --- a/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php @@ -53,14 +53,24 @@ class BCryptPasswordEncoder extends BasePasswordEncoder * the "$2y$" salt prefix (which is not available in the early PHP versions). * @see https://github.com/ircmaxell/password_compat/issues/10#issuecomment-11203833 * + * It is almost best to **not** pass a salt and let PHP generate one for you. + * * @param string $raw The password to encode * @param string $salt The salt * * @return string The encoded password + * + * @link http://lxr.php.net/xref/PHP_5_5/ext/standard/password.c#111 */ public function encodePassword($raw, $salt) { - return password_hash($raw, PASSWORD_BCRYPT, array('cost' => $this->cost)); + $options = array('cost' => $this->cost); + + if ($salt) { + $options['salt'] = $salt; + } + + return password_hash($raw, PASSWORD_BCRYPT, $options); } /** From 6b715136c8aca719a14b142f996e7a56acbe9c7a Mon Sep 17 00:00:00 2001 From: Bilal Amarni Date: Wed, 5 Jun 2013 16:35:05 +0200 Subject: [PATCH 16/33] fixed date type format pattern regex --- .../Form/Extension/Core/Type/DateType.php | 2 +- .../Extension/Core/Type/DateTypeTest.php | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 71ae631c67..648ab1b7e5 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -144,7 +144,7 @@ class DateType extends AbstractType // set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy) // lookup various formats at http://userguide.icu-project.org/formatparse/datetime - if (preg_match('/^([yMd]+).+([yMd]+).+([yMd]+)$/', $pattern)) { + if (preg_match('/^([yMd]+)[^yMd]*([yMd]+)[^yMd]*([yMd]+)$/', $pattern)) { $pattern = preg_replace(array('/y+/', '/M+/', '/d+/'), array('{{ year }}', '{{ month }}', '{{ day }}'), $pattern); } else { // default fallback diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index c0d7da676b..6d4dd2c8a7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -267,6 +267,29 @@ class DateTypeTest extends LocalizedTestCase $this->assertEquals('06*2010*02', $form->getViewData()); } + /** + * @dataProvider provideDateFormats + */ + public function testDatePatternWithFormatOption($format, $pattern) + { + $form = $this->factory->create('date', null, array( + 'format' => $format, + )); + + $view = $form->createView(); + + $this->assertEquals($pattern, $view->vars['date_pattern']); + } + + public function provideDateFormats() + { + return array( + array('dMy', '{{ day }}{{ month }}{{ year }}'), + array('d-M-yyyy', '{{ day }}-{{ month }}-{{ year }}'), + array('M d y', '{{ month }} {{ day }} {{ year }}'), + ); + } + /** * This test is to check that the strings '0', '1', '2', '3' are no accepted * as valid IntlDateFormatter constants for FULL, LONG, MEDIUM or SHORT respectively. From bcbbb28f76d38faca80e2cd2fd661afc8001f7c9 Mon Sep 17 00:00:00 2001 From: Tiago Garcia Date: Tue, 4 Jun 2013 23:48:28 +0200 Subject: [PATCH 17/33] Throw exception if value is passed to VALUE_NONE input, long syntax --- src/Symfony/Component/Console/Input/ArgvInput.php | 6 +++++- .../Component/Console/Tests/Input/ArgvInputTest.php | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 0f9b62c53f..6c3267c9fd 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -134,7 +134,7 @@ class ArgvInput extends Input break; } else { - $this->addLongOption($option->getName(), true); + $this->addLongOption($option->getName(), null); } } } @@ -220,6 +220,10 @@ class ArgvInput extends Input $value = null; } + if (null !== $value && !$option->acceptValue()) { + throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name, $value)); + } + if (null === $value && $option->acceptValue() && count($this->parsed)) { // if option accepts an optional or mandatory argument // let's see if there is one provided diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 472a91580c..532841c0b0 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -105,6 +105,15 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase $this->assertEquals('The "-o" option does not exist.', $e->getMessage(), '->parse() throws a \RuntimeException if a value is passed to an option which does not take one'); } + try { + $input = new ArgvInput(array('cli.php', '--foo=bar')); + $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE)))); + $this->fail('->parse() throws a \RuntimeException if a value is passed to an option which does not take one'); + } catch (\Exception $e) { + $this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if a value is passed to an option which does not take one'); + $this->assertEquals('The "--foo" option does not accept a value.', $e->getMessage(), '->parse() throws a \RuntimeException if a value is passed to an option which does not take one'); + } + try { $input = new ArgvInput(array('cli.php', 'foo', 'bar')); $input->bind(new InputDefinition()); From ed3bcb047ae0e3b205e2e6ed7876efc21d830ebf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 13 Jun 2013 13:40:37 +0200 Subject: [PATCH 18/33] [DomCrawler] added a note about the default charset --- src/Symfony/Component/DomCrawler/Crawler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index c56ba2afe2..f39c5d333d 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -78,6 +78,10 @@ class Crawler extends \SplObjectStorage /** * Adds HTML/XML content. * + * If the charset is not set via the content type, it is assumed + * to be ISO-8859-1, which is the default charset defined by the + * HTTP 1.1 specification. + * * @param string $content A string to parse as HTML/XML * @param null|string $type The content type of the string * From 77f2aa8ec878667219464b3998e5f40a5fa7f9f3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 13 Jun 2013 14:48:01 +0200 Subject: [PATCH 19/33] [HttpFoundation] fixed issue with session_regenerate_id (closes #7380) --- .../Session/Storage/NativeSessionStorage.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 4b9be5e9b2..d168f3891f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -205,7 +205,15 @@ class NativeSessionStorage implements SessionStorageInterface $this->metadataBag->stampNew(); } - return session_regenerate_id($destroy); + $ret = session_regenerate_id($destroy); + + // workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl + session_write_close(); + $backup = $_SESSION; + session_start(); + $_SESSION = $backup; + + return $ret; } /** From c0da3ae445d0da2cd5eb30728fc28983289cacda Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 13 Jun 2013 15:45:36 +0200 Subject: [PATCH 20/33] [Process] Disable exception on stream_select timeout --- src/Symfony/Component/Process/Process.php | 34 ++++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index ed4cccff3c..deabdacfe6 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -306,15 +306,17 @@ class Process $w = $writePipes; $e = null; - $n = @stream_select($r, $w, $e, 0, ceil(static::TIMEOUT_PRECISION * 1E6)); - - if (false === $n) { + if (false === $n = @stream_select($r, $w, $e, 0, ceil(static::TIMEOUT_PRECISION * 1E6))) { + // if a system call has been interrupted, forget about it, let's try again + if ($this->hasSystemCallBeenInterrupted()) { + continue; + } break; } - if ($n === 0) { - proc_terminate($this->process); - throw new RuntimeException('The process timed out.'); + // nothing has changed, let's wait until the process is ready + if (0 === $n) { + continue; } if ($w) { @@ -404,10 +406,9 @@ class Process // let's have a look if something changed in streams if (false === $n = @stream_select($r, $w, $e, 0, ceil(static::TIMEOUT_PRECISION * 1E6))) { - $lastError = error_get_last(); - - // stream_select returns false when the `select` system call is interrupted by an incoming signal - if (isset($lastError['message']) && false === stripos($lastError['message'], 'interrupted system call')) { + // if a system call has been interrupted, forget about it, let's try again + // otherwise, an error occured, let's reset pipes + if (!$this->hasSystemCallBeenInterrupted()) { $this->pipes = array(); } @@ -1140,4 +1141,17 @@ class Process } } } + + /** + * Returns true if a system call has been interrupted. + * + * @return Boolean + */ + private function hasSystemCallBeenInterrupted() + { + $lastError = error_get_last(); + + // stream_select returns false when the `select` system call is interrupted by an incoming signal + return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call'); + } } From 3381f3f897fb587056e9a62d4874d5c9992addd4 Mon Sep 17 00:00:00 2001 From: Rick Prent Date: Thu, 13 Jun 2013 21:00:58 +0200 Subject: [PATCH 21/33] Feature/fix unit tests --- .../Process/Tests/AbstractProcessTest.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php index 5cd52efbd9..0415ca5647 100644 --- a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php +++ b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php @@ -47,9 +47,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase public function testStopWithTimeoutIsActuallyWorking() { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Stop with timeout does not work on windows, it requires posix signals'); - } + $this->verifyPosixIsEnabled(); // exec is mandatory here since we send a signal to the process // see https://github.com/symfony/symfony/issues/5030 about prepending @@ -454,9 +452,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase public function testSignal() { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('POSIX signals do not work on windows'); - } + $this->verifyPosixIsEnabled(); $process = $this->getProcess('exec php -f ' . __DIR__ . '/SignalListener.php'); $process->start(); @@ -474,13 +470,20 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase * @expectedException Symfony\Component\Process\Exception\LogicException */ public function testSignalProcessNotRunning() + { + $this->verifyPosixIsEnabled(); + $process = $this->getProcess('php -m'); + $process->signal(SIGHUP); + } + + private function verifyPosixIsEnabled() { if (defined('PHP_WINDOWS_VERSION_BUILD')) { $this->markTestSkipped('POSIX signals do not work on windows'); } - - $process = $this->getProcess('php -m'); - $process->signal(SIGHUP); + if (!defined('SIGUSR1')) { + $this->markTestSkipped('The pcntl extension is not enabled'); + } } /** From ab1439eb321d44e80c02e73c75f3e79c3315828a Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Sat, 15 Jun 2013 18:35:00 +0100 Subject: [PATCH 22/33] [Console] Fixed the table rendering with multi-byte strings. --- .../Component/Console/Helper/TableHelper.php | 8 +++++- .../Console/Tests/Helper/TableHelperTest.php | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Helper/TableHelper.php b/src/Symfony/Component/Console/Helper/TableHelper.php index cf18e4913c..c18f29598a 100644 --- a/src/Symfony/Component/Console/Helper/TableHelper.php +++ b/src/Symfony/Component/Console/Helper/TableHelper.php @@ -359,12 +359,18 @@ class TableHelper extends Helper private function renderCell(array $row, $column, $cellFormat) { $cell = isset($row[$column]) ? $row[$column] : ''; + $width = $this->getColumnWidth($column); + + // str_pad won't work properly with multi-byte strings, we need to fix the padding + if (function_exists('mb_strlen') && false !== $encoding = mb_detect_encoding($cell)) { + $width += strlen($cell) - mb_strlen($cell, $encoding); + } $this->output->write(sprintf( $cellFormat, str_pad( $this->paddingChar.$cell.$this->paddingChar, - $this->getColumnWidth($column), + $width, $this->paddingChar, $this->padType ) diff --git a/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php index b2aa82b2de..5873a7fda6 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableHelperTest.php @@ -174,6 +174,33 @@ 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); From 0cb95e07ac2031b60349114c1b1f17e0b75e8f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Simon?= Date: Sun, 16 Jun 2013 11:03:18 +0200 Subject: [PATCH 23/33] added a node about HTML extension in readme --- src/Symfony/Component/CssSelector/README.md | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Symfony/Component/CssSelector/README.md b/src/Symfony/Component/CssSelector/README.md index c4409fef6c..8c08e5ebed 100644 --- a/src/Symfony/Component/CssSelector/README.md +++ b/src/Symfony/Component/CssSelector/README.md @@ -10,6 +10,28 @@ equivalents: print CssSelector::toXPath('div.item > h4 > a'); +HTML and XML are different +-------------------------- + +- The `CssSelector` component comes with an `HTML` extension which is enabled by default. +- If you need to use this component with `XML` documents, you have to disable `HTML` extension. +- `HTML` tag & attribute names are always lower-cased, with `XML` they are case-sensistive. + +Disable & enable `HTML` extension: + + // disable `HTML` extension: + CssSelector::disableHtmlExtension(); + // re-enable `HTML` extension: + CssSelector::enableHtmlExtension(); + +What brings `HTML` extension? +- Tag names are lower-cased +- Attribute names are lower-cased +- Adds following pseudo-classes: + - `checked`, `link`, `disabled`, `enabled`, `selected`: used with form tags + - `invalid`, `hover`, `visited`: always select nothing +- Adds `lang()` function + Resources --------- From caaaec3155a61e71b935dded6811df4ef634e3d9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 17 Jun 2013 09:15:51 +0200 Subject: [PATCH 24/33] [CssSelector] tweaked README file (closes #8287) --- src/Symfony/Component/CssSelector/README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/CssSelector/README.md b/src/Symfony/Component/CssSelector/README.md index 8c08e5ebed..5075cdb7eb 100644 --- a/src/Symfony/Component/CssSelector/README.md +++ b/src/Symfony/Component/CssSelector/README.md @@ -13,24 +13,21 @@ equivalents: HTML and XML are different -------------------------- -- The `CssSelector` component comes with an `HTML` extension which is enabled by default. -- If you need to use this component with `XML` documents, you have to disable `HTML` extension. -- `HTML` tag & attribute names are always lower-cased, with `XML` they are case-sensistive. - -Disable & enable `HTML` extension: +The `CssSelector` component comes with an `HTML` extension which is enabled by +default. If you need to use this component with `XML` documents, you have to +disable this `HTML` extension. That's because, `HTML` tag & attribute names +are always lower-cased, but case-sensitive in `XML`: // disable `HTML` extension: CssSelector::disableHtmlExtension(); + // re-enable `HTML` extension: CssSelector::enableHtmlExtension(); -What brings `HTML` extension? -- Tag names are lower-cased -- Attribute names are lower-cased -- Adds following pseudo-classes: - - `checked`, `link`, `disabled`, `enabled`, `selected`: used with form tags - - `invalid`, `hover`, `visited`: always select nothing -- Adds `lang()` function +When the `HTML` extension is enabled, tag names are lower-cased, attribute +names are lower-cased, the following extra pseudo-classes are supported: +`checked`, `link`, `disabled`, `enabled`, `selected`, `invalid`, `hover`, +`visited`, and the `lang()` function is also added. Resources --------- From 494e8035adc29d4d9dd9c6b3c61d2b4ce1a3e1c7 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 17 Jun 2013 13:34:43 +0100 Subject: [PATCH 25/33] [DependencyInjection] Replaced try/catch block with an @expectedException annotation in a test. --- .../Tests/Loader/IniFileLoaderTest.php | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index bba9c8c85f..220ad7fe4d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -50,31 +50,25 @@ class IniFileLoaderTest extends \PHPUnit_Framework_TestCase /** * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The file "foo.ini" does not exist (in: */ public function testExceptionIsRaisedWhenIniFileDoesNotExist() { - try { - $this->loader->load('foo.ini'); - $this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist'); - } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist'); - $this->assertStringStartsWith('The file "foo.ini" does not exist (in: ', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist'); - } + $this->loader->load('foo.ini'); } /** * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "nonvalid.ini" file is not valid. */ public function testExceptionIsRaisedWhenIniFileCannotBeParsed() { - try { - @$this->loader->load('nonvalid.ini'); - $this->fail('->load() throws an InvalidArgumentException if the loaded file is not parseable'); - } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not parseable'); - $this->assertEquals('The "nonvalid.ini" file is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file is not parseable'); - } + @$this->loader->load('nonvalid.ini'); } /** From bf881db902c6bedce69c20801fddd4f0bbd263a0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 19 Jun 2013 14:09:01 +0200 Subject: [PATCH 26/33] updated CHANGELOG for 2.2.3 --- CHANGELOG-2.2.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG-2.2.md b/CHANGELOG-2.2.md index 7c7001f03c..4b5eccd9db 100644 --- a/CHANGELOG-2.2.md +++ b/CHANGELOG-2.2.md @@ -7,6 +7,26 @@ 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.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) From 8c353ddde6bcd6f1ab7c664e6800dbaf17f4d649 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 19 Jun 2013 14:09:22 +0200 Subject: [PATCH 27/33] update CONTRIBUTORS for 2.2.3 --- CONTRIBUTORS.md | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 4cc61bf785..5d9190350e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -9,8 +9,8 @@ Symfony2 is the result of the work of many people who made the code better - Victor Berchet (victor) - Jordi Boggiano (seldaek) - Johannes S (johannes) - - Kris Wallsmith (kriswallsmith) - Tobias Schultze (tobion) + - Kris Wallsmith (kriswallsmith) - Christophe Coevoet (stof) - Pascal Borreli (pborreli) - Karma Dordrak (drak) @@ -51,20 +51,20 @@ Symfony2 is the result of the work of many people who made the code better - Hidenori Goto (hidenorigoto) - Fran Moreno (franmomu) - Andrej Hudec (pulzarraider) + - Grégoire Pineau (lyrixx) - Lee McDermott - Brandon Turner - Daniel Holmes (dholmes) - Brikou Carré (brikou) - John Wards (johnwards) - - Grégoire Pineau (lyrixx) - Antoine Hérault (herzult) - Bart van den Burg (burgov) + - Toni Uebernickel (havvg) - Tim Nagel (merk) - Włodzimierz Gajda (gajdaw) - Michel Weimerskirch (mweimerskirch) - Christian Raue - Michal Piotrowski (eventhorizon) - - Toni Uebernickel (havvg) - Colin Frei - lenar - Fabien Pennequin (fabienpennequin) @@ -220,6 +220,7 @@ Symfony2 is the result of the work of many people who made the code better - Emanuele Gaspari (inmarelibero) - Brian King - Jan Schumann + - Ruben Gonzalez (rubenrua) - Antonio J. García Lagar (ajgarlag) - Olivier Dolbeau (odolbeau) - Robert Kiss (kepten) @@ -233,7 +234,9 @@ Symfony2 is the result of the work of many people who made the code better - Marcin Sikoń (marphi) - Miquel Rodríguez Telep (mrtorrent) - Filippo Tessarotto + - Mark Sonnabaum - Adam Harvey + - Pierre-Yves LEBECQ (pylebecq) - Laurent Bachelier (laurentb) - Fabian Lange (codingfabian) - Yoshio HANAWA @@ -255,6 +258,7 @@ Symfony2 is the result of the work of many people who made the code better - alexpods - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) + - Vitaliy Zakharov (zakharovvi) - Matthijs van den Bos - Joel Wurtz - Nils Adermann (naderman) @@ -295,7 +299,6 @@ Symfony2 is the result of the work of many people who made the code better - Markus Bachmann (baachi) - aubx - Max Rath (drak3) - - Ruben Gonzalez (rubenrua) - Sinan Eldem - DerManoMann - alquerci @@ -322,12 +325,10 @@ Symfony2 is the result of the work of many people who made the code better - cedric lombardot (cedriclombardot) - John Kary (johnkary) - Hossein Bukhamsin - - Pierre-Yves LEBECQ (pylebecq) - Fabrice Bernhard (fabriceb) - Oleg Zinchenko (cystbear) - Johannes Klauss (cloppy) - fzerorubigd - - Mark Sonnabaum - develop - Atsuhiro KUBO (iteman) - Samy Dindane (dinduks) @@ -374,7 +375,6 @@ Symfony2 is the result of the work of many people who made the code better - Luis Cordova (cordoval) - Philipp Kräutli (pkraeutli) - Stefano Sala (stefano.sala) - - Vitaliy Zakharov (zakharovvi) - frost-nzcr4 - Abhoryo - Fabian Vogler (fabian) @@ -430,6 +430,7 @@ Symfony2 is the result of the work of many people who made the code better - xaav - Mahmoud Mostafa (mahmoud) - Juti Noppornpitak + - lancergr - Mei Gwilym - ttomor - Sander Coolen @@ -479,6 +480,7 @@ Symfony2 is the result of the work of many people who made the code better - DerManoMann - Roland Franssen (ro0) - Jochen Bayer (jocl) + - Jerome TAMARELLE - Jeremy Bush - Evan Villemez - Péter Buri (burci) @@ -486,6 +488,7 @@ Symfony2 is the result of the work of many people who made the code better - kaiwa - Albert Ganiev (helios-ag) - Neil Katin + - peter - Gustavo Adrian - Brooks Boyd - Roger Webb @@ -493,6 +496,7 @@ Symfony2 is the result of the work of many people who made the code better - Felicitus - Paul Matthews - Philipp Strube + - Christian Sciberras - Clement Herreman (clemherreman) - Marco - Alberto Aldegheri @@ -511,6 +515,7 @@ Symfony2 is the result of the work of many people who made the code better - Ludek Stepan - Balázs Benyó (duplabe) - Marc Morera (mmoreram) + - Saem Ghani - Sebastian Utz - Keri Henare (kerihenare) - Cédric Lahouste (rapotor) @@ -524,6 +529,7 @@ Symfony2 is the result of the work of many people who made the code better - Lance McNearney - Alberto Pirovano (geezmo) - Gabor Toth (tgabi333) + - Martin Pärtel - Xavier Briand (xavierbriand) - Evan Kaufman - Romain Geissler @@ -554,6 +560,7 @@ Symfony2 is the result of the work of many people who made the code better - Benjamin Bender - Konrad Mohrfeldt - Benoit Lévêque (benoit_leveque) + - Stelian Mocanita (stelian) - jskvara - Mephistofeles - Hoffmann András @@ -641,6 +648,7 @@ Symfony2 is the result of the work of many people who made the code better - partugal - Robert Campbell - Matt Lehner + - Aleksey Podskrebyshev - cyrillej - Alex Pods - timaschew @@ -686,15 +694,18 @@ Symfony2 is the result of the work of many people who made the code better - Nicolas A. Bérard-Nault - Gladhon - Saem Ghani + - Stefan Oderbolz - Alexey Popkov - Piotr Błasiak - Arnaud Buathier (arnapou) - chesteroni (chesteroni) + - Daniele Cesarini (ijanki) - Simon CONSTANS (kosssi) - Mauricio Lopez (sanctuary29) - Wotre - goohib - Xavier HAUSHERR + - ghazy ben ahmed - Myke79 - Brian Debuire - Lars Vierbergen From 74a033d95b809f67ea4ccad9f07fad8422448319 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 19 Jun 2013 14:09:49 +0200 Subject: [PATCH 28/33] updated VERSION for 2.2.3 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 265c8fee84..febe26e79f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -62,12 +62,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.2.3-DEV'; + const VERSION = '2.2.3'; const VERSION_ID = '20203'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '2'; const RELEASE_VERSION = '3'; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From 5b14665964b6f17412aa8343f7f39dc2a5616e21 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 19 Jun 2013 15:03:30 +0200 Subject: [PATCH 29/33] bumped Symfony version to 2.2.4 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index febe26e79f..8d99a7938d 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -62,12 +62,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.2.3'; - const VERSION_ID = '20203'; + const VERSION = '2.2.4-DEV'; + const VERSION_ID = '20204'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '2'; - const RELEASE_VERSION = '3'; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = '4'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From 349218692e23be9a6de2e800d43cfd2a4b87196e Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 21 Jun 2013 09:19:25 +0100 Subject: [PATCH 30/33] [Intl] Fixed tests failing on PHP 5.5 --- .../AbstractIntlDateFormatterTest.php | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index 6dde36a704..84f6433a57 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -850,27 +850,16 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase public function setTimeZoneIdProvider() { - $data = array( + return array( array('UTC', 'UTC'), array('GMT', 'GMT'), array('GMT-03:00', 'GMT-03:00'), array('Europe/Zurich', 'Europe/Zurich'), + array('GMT-0300', 'GMT-0300'), + array('Foo/Bar', 'Foo/Bar'), + array('GMT+00:AA', 'GMT+00:AA'), + array('GMT+00AA', 'GMT+00AA'), ); - - // When time zone not exists, uses UTC by default - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $data[] = array('GMT-0300', 'UTC'); - $data[] = array('Foo/Bar', 'UTC'); - $data[] = array('GMT+00:AA', 'UTC'); - $data[] = array('GMT+00AA', 'UTC'); - } else { - $data[] = array('GMT-0300', 'GMT-0300'); - $data[] = array('Foo/Bar', 'Foo/Bar'); - $data[] = array('GMT+00:AA', 'GMT+00:AA'); - $data[] = array('GMT+00AA', 'GMT+00AA'); - } - - return $data; } protected function getDefaultDateFormatter($pattern = null) From 69ec7c8363086b200dc0b79b6314979f7b9eaff1 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 21 Jun 2013 09:32:21 +0100 Subject: [PATCH 31/33] Removed PHP 5.5 from the allowed failures. --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b5b7da55bc..8a87800c5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,6 @@ php: - 5.4 - 5.5 -matrix: - allow_failures: - - php: 5.5 - before_script: - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' From a2e440a52c1e24093cc27b153f4ff716ec4138ce Mon Sep 17 00:00:00 2001 From: Michael Squires Date: Sat, 22 Jun 2013 22:16:37 -0600 Subject: [PATCH 32/33] Fix grammar --- src/Symfony/Component/Routing/Generator/UrlGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index 9dac1c1f4c..5ab5dd2558 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -141,7 +141,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt } /** - * @throws MissingMandatoryParametersException When some parameters are missing that mandatory for the route + * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */ From c875d0aae19629e63046f74c0d951466646c2a6c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 23 Jun 2013 09:35:41 +0200 Subject: [PATCH 33/33] [Form] fixed INF usage which does not work on Solaris (closes #8246) --- .../Core/DataTransformer/NumberToLocalizedStringTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 689c74a94a..b0c59b3ede 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -128,7 +128,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface throw new TransformationFailedException($formatter->getErrorMessage()); } - if ($result >= INF || $result <= -INF) { + if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) { throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like'); }