From ecc3df5aae49298368f0fcc193b65a07baefd9df Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 30 Mar 2015 20:17:55 +0200 Subject: [PATCH 1/9] let Travis builds fail when PHP 7 jobs fail --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b27111e496..e06aab56b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,6 @@ matrix: - php: 5.6 env: deps=high - php: nightly - allow_failures: - - php: nightly fast_finish: true services: mongodb From d60b2bba601f72a7f43f0df65a3bd4f63a7749a8 Mon Sep 17 00:00:00 2001 From: Johnny Peck Date: Wed, 24 Jun 2015 01:08:56 -0400 Subject: [PATCH 2/9] Update EngineInterface.php Grammer in doc comment. --- src/Symfony/Component/Templating/EngineInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Templating/EngineInterface.php b/src/Symfony/Component/Templating/EngineInterface.php index a28da649f3..d694d71e40 100644 --- a/src/Symfony/Component/Templating/EngineInterface.php +++ b/src/Symfony/Component/Templating/EngineInterface.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Templating; /** * EngineInterface is the interface each engine must implement. * - * All methods relies on a template name. A template name is a + * All methods rely on a template name. A template name is a * "logical" name for the template, and as such it does not refer to * a path on the filesystem (in fact, the template can be stored * anywhere, like in a database). From c3146592d9dbf6750db067ce1785908da463118d Mon Sep 17 00:00:00 2001 From: nuncanada Date: Sat, 20 Jun 2015 21:23:51 -0300 Subject: [PATCH 3/9] Fixing DbalSessionHandler to work with a Oracle "limitation" or bug? --- .../Doctrine/HttpFoundation/DbalSessionHandler.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index 88260a5270..5b749fc5bc 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -159,6 +159,14 @@ class DbalSessionHandler implements \SessionHandlerInterface $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); $mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); + + //Oracle has a bug that will intermitently happen if you + //have only 1 bind on a CLOB field for 2 different statements + //(INSERT and UPDATE in this case) + if ('oracle' == $this->con->getDatabasePlatform()->getName()) { + $mergeStmt->bindParam(':data2', $encoded, \PDO::PARAM_STR); + } + $mergeStmt->execute(); return true; @@ -224,7 +232,7 @@ class DbalSessionHandler implements \SessionHandlerInterface // DUAL is Oracle specific dummy table return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ". "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time"; + "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data2, $this->timeCol = :time"; case $this->con->getDatabasePlatform() instanceof SQLServer2008Platform: // MERGE is only available since SQL Server 2008 and must be terminated by semicolon // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx From 9b7d4c7613b5b7e351e32c6f60c08377388150d4 Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Sat, 14 Feb 2015 14:38:59 +0100 Subject: [PATCH 4/9] Annotated routes with a variadic parameter There are no variadic default values and that generate a fatal error. --- .../AnnotatedClasses/VariadicClass.php | 19 +++++++++++++++++++ .../Tests/Loader/AnnotationFileLoaderTest.php | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php new file mode 100644 index 0000000000..f0fe7f095e --- /dev/null +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses; + +class VariadicClass +{ + public function routeAction(...$params) + { + } +} diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index f0a8a0e329..94b6d02981 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Routing\Tests\Loader; use Symfony\Component\Routing\Loader\AnnotationFileLoader; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Routing\Annotation\Route; class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest { @@ -34,6 +35,19 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); } + /** + * @requires PHP 5.6 + */ + public function testLoadVariadic() + { + $route = new Route(["path" => "/path/to/{id}"]); + $this->reader->expects($this->once())->method('getClassAnnotation'); + $this->reader->expects($this->once())->method('getMethodAnnotations') + ->will($this->returnValue([$route])); + + $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/VariadicClass.php'); + } + public function testSupports() { $fixture = __DIR__.'/../Fixtures/annotated.php'; From 73c5eff44d77d8970a4f472c81cfd197c9878dac Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 1 Aug 2015 21:33:42 +0200 Subject: [PATCH 5/9] Fix the retrieval of the default value for variadic arguments --- .../Component/Routing/Loader/AnnotationClassLoader.php | 2 +- .../VariadicClass.php | 2 +- .../Routing/Tests/Loader/AnnotationClassLoaderTest.php | 1 + .../Routing/Tests/Loader/AnnotationFileLoaderTest.php | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) rename src/Symfony/Component/Routing/Tests/Fixtures/{AnnotatedClasses => OtherAnnotatedClasses}/VariadicClass.php (81%) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index e35f807b4c..11d8f34d5a 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -180,7 +180,7 @@ abstract class AnnotationClassLoader implements LoaderInterface $defaults = array_replace($globals['defaults'], $annot->getDefaults()); foreach ($method->getParameters() as $param) { - if (!isset($defaults[$param->getName()]) && $param->isOptional()) { + if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) { $defaults[$param->getName()] = $param->getDefaultValue(); } } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php b/src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php similarity index 81% rename from src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php rename to src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php index f0fe7f095e..729c9b4d07 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/VariadicClass.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses; +namespace Symfony\Component\Routing\Tests\Fixtures\OtherAnnotatedClasses; class VariadicClass { diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php index 07efaf7778..67d07c3f5d 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Routing\Annotation\Route; class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest { protected $loader; + private $reader; protected function setUp() { diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index 94b6d02981..9a83994f9a 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -40,12 +40,12 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest */ public function testLoadVariadic() { - $route = new Route(["path" => "/path/to/{id}"]); + $route = new Route(array('path' => '/path/to/{id}')); $this->reader->expects($this->once())->method('getClassAnnotation'); $this->reader->expects($this->once())->method('getMethodAnnotations') - ->will($this->returnValue([$route])); + ->will($this->returnValue(array($route))); - $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/VariadicClass.php'); + $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php'); } public function testSupports() From 6c22f0af24deb033d98fc59455f4f31317987c2e Mon Sep 17 00:00:00 2001 From: Valentin VALCIU Date: Sun, 12 Jul 2015 00:06:45 +0300 Subject: [PATCH 6/9] [HttpFoundation] fixed the check of 'proxy-revalidate' in Response::mustRevalidate() --- .../Component/HttpFoundation/Response.php | 2 +- .../HttpFoundation/Tests/ResponseTest.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 9b399189b4..df36c5a931 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -587,7 +587,7 @@ class Response */ public function mustRevalidate() { - return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate'); + return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate'); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 7dc3330912..730ba09b43 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -92,6 +92,22 @@ class ResponseTest extends ResponseTestCase $this->assertFalse($response->mustRevalidate()); } + public function testMustRevalidateWithMustRevalidateCacheControlHeader() + { + $response = new Response(); + $response->headers->set('cache-control', 'must-revalidate'); + + $this->assertTrue($response->mustRevalidate()); + } + + public function testMustRevalidateWithProxyRevalidateCacheControlHeader() + { + $response = new Response(); + $response->headers->set('cache-control', 'proxy-revalidate'); + + $this->assertTrue($response->mustRevalidate()); + } + public function testSetNotModified() { $response = new Response(); From 8d2b8881f53c144f09dabf3915efe6e74c58d204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 4 Aug 2015 12:17:13 +0200 Subject: [PATCH 7/9] do not remove space between attributes This piece of code adds a space then removes it immediately. One could think that only the space after the last element of the loop is removed, but this is not the case. Space between loop elements are also removed. --- .../Bridge/Twig/Resources/views/Form/form_div_layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 243c9b1879..5e5390b6d7 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -304,7 +304,7 @@ {%- block widget_container_attributes -%} {% if id is not empty %}id="{{ id }}" {% endif %} - {%- for attrname, attrvalue in attr %}{{ attrname }}="{{ attrvalue }}" {%- endfor -%} + {%- for attrname, attrvalue in attr %}{{ attrname }}="{{ attrvalue }}" {% endfor -%} {%- endblock widget_container_attributes -%} {%- block button_attributes -%} From ce2a3717fdc1474bbcba4c53f51f498d4caf0b85 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 5 Aug 2015 12:11:53 +0200 Subject: [PATCH 8/9] [travis] Build phpunit with local components --- .travis.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b27111e496..9c138eb499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,12 +42,16 @@ before_install: - if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; install: - - if [ "$deps" = "no" ]; then composer --prefer-source install; fi; + - composer --prefer-source install + - composer require --no-update phpunit/phpunit '*' + - composer require --no-update phpunit/phpunit-mock-objects '2.3.0' # See https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 + - composer update --prefer-stable --prefer-source phpunit/phpunit - components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') - if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $components; fi; + - PHPUNIT="$(readlink -f ./vendor/bin/phpunit) --colors=always" script: - - if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; - - if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi; - - if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; - - if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; '$PHPUNIT' --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi; + - if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; '$PHPUNIT' --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; '$PHPUNIT' --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; From 7fdba25e4fc92e4b3add0d515061d681691c9872 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 5 Aug 2015 17:43:06 +0200 Subject: [PATCH 9/9] Clean wrong whitespaces --- .../Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index 5b749fc5bc..faa623823b 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -161,10 +161,10 @@ class DbalSessionHandler implements \SessionHandlerInterface $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); //Oracle has a bug that will intermitently happen if you - //have only 1 bind on a CLOB field for 2 different statements + //have only 1 bind on a CLOB field for 2 different statements //(INSERT and UPDATE in this case) if ('oracle' == $this->con->getDatabasePlatform()->getName()) { - $mergeStmt->bindParam(':data2', $encoded, \PDO::PARAM_STR); + $mergeStmt->bindParam(':data2', $encoded, \PDO::PARAM_STR); } $mergeStmt->execute();