From 8aa322ca7222672cdb7448ddc60119e7290dbf21 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 12 Apr 2014 18:24:05 +0200 Subject: [PATCH 1/3] [TwigBundle] removed undefined argument --- src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php | 6 ++---- src/Symfony/Bundle/TwigBundle/Resources/config/debug.xml | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php b/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php index 33178e70a8..1a73eee9bb 100644 --- a/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php +++ b/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php @@ -12,7 +12,6 @@ namespace Symfony\Bundle\TwigBundle\Debug; use Symfony\Bundle\TwigBundle\TwigEngine; -use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables; use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Config\FileLocatorInterface; @@ -33,11 +32,10 @@ class TimedTwigEngine extends TwigEngine * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance * @param FileLocatorInterface $locator A FileLocatorInterface instance * @param Stopwatch $stopwatch A Stopwatch instance - * @param GlobalVariables $globals A GlobalVariables instance */ - public function __construct(\Twig_Environment $environment, TemplateNameParserInterface $parser, FileLocatorInterface $locator, Stopwatch $stopwatch, GlobalVariables $globals = null) + public function __construct(\Twig_Environment $environment, TemplateNameParserInterface $parser, FileLocatorInterface $locator, Stopwatch $stopwatch) { - parent::__construct($environment, $parser, $locator, $globals); + parent::__construct($environment, $parser, $locator); $this->stopwatch = $stopwatch; } diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/debug.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/debug.xml index 2857e18b73..c44ae63121 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/debug.xml @@ -14,7 +14,6 @@ - From f4adfc4d791bc3f49985501e0bbc0c88d0a08362 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 12 Apr 2014 19:19:51 +0200 Subject: [PATCH 2/3] [HttpKernel] fixed an error message --- .../HttpKernel/DataCollector/RequestDataCollector.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index be08e305a2..9371748e3c 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -298,10 +298,11 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter } elseif ($expires instanceof \DateTime) { $expires = $expires->getTimestamp(); } else { - $expires = strtotime($expires); - if (false === $expires || -1 == $expires) { - throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expires)); + $tmp = strtotime($expires); + if (false === $tmp || -1 == $tmp) { + throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid (%s).', $expires)); } + $expires = $tmp; } $cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T')); From 4b7a2753636c1db849b6741884aa4b0ef3c0b60f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 12 Apr 2014 18:30:45 +0200 Subject: [PATCH 3/3] removed extra/unsupported arguments --- .../EventDispatcher/Tests/GenericEventTest.php | 2 +- .../Storage/Handler/PdoSessionHandlerTest.php | 18 +++++++++--------- .../Tests/Matcher/ApacheUrlMatcherTest.php | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php index c1e22f4451..5dfda92f2a 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php @@ -34,7 +34,7 @@ class GenericEventTest extends \PHPUnit_Framework_TestCase parent::setUp(); $this->subject = new \stdClass(); - $this->event = new GenericEvent($this->subject, array('name' => 'Event'), 'foo'); + $this->event = new GenericEvent($this->subject, array('name' => 'Event')); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index fe007ba48d..14e2dba526 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -32,7 +32,7 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testIncompleteOptions() { $this->setExpectedException('InvalidArgumentException'); - $storage = new PdoSessionHandler($this->pdo, array(), array()); + $storage = new PdoSessionHandler($this->pdo, array()); } public function testWrongPdoErrMode() @@ -42,42 +42,42 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase $pdo->exec("CREATE TABLE sessions (sess_id VARCHAR(255) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)"); $this->setExpectedException('InvalidArgumentException'); - $storage = new PdoSessionHandler($pdo, array('db_table' => 'sessions'), array()); + $storage = new PdoSessionHandler($pdo, array('db_table' => 'sessions')); } public function testWrongTableOptionsWrite() { - $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'bad_name'), array()); + $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); $this->setExpectedException('RuntimeException'); $storage->write('foo', 'bar'); } public function testWrongTableOptionsRead() { - $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'bad_name'), array()); + $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); $this->setExpectedException('RuntimeException'); $storage->read('foo', 'bar'); } public function testWriteRead() { - $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions')); $storage->write('foo', 'bar'); $this->assertEquals('bar', $storage->read('foo'), 'written value can be read back correctly'); } public function testMultipleInstances() { - $storage1 = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + $storage1 = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions')); $storage1->write('foo', 'bar'); - $storage2 = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + $storage2 = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions')); $this->assertEquals('bar', $storage2->read('foo'), 'values persist between instances'); } public function testSessionDestroy() { - $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions')); $storage->write('foo', 'bar'); $this->assertCount(1, $this->pdo->query('SELECT * FROM sessions')->fetchAll()); @@ -88,7 +88,7 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testSessionGC() { - $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array()); + $storage = new PdoSessionHandler($this->pdo, array('db_table' => 'sessions')); $storage->write('foo', 'bar'); $storage->write('baz', 'bar'); diff --git a/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php index 2810cbad51..38127a09f6 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -40,7 +40,7 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase $_SERVER = $server; - $result = $matcher->match($pathinfo, $server); + $result = $matcher->match($pathinfo); $this->assertSame(var_export($expect, true), var_export($result, true)); }