From fa247495374d2ea9e3dcf3069fd6905d31e2de0a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Mar 2014 17:04:39 +0100 Subject: [PATCH 1/2] [Yaml] fix for a HHVM bug --- src/Symfony/Component/Yaml/Tests/DumperTest.php | 2 +- src/Symfony/Component/Yaml/Tests/ParserTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php index c51a257dc0..ec2c65e3d0 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -95,7 +95,7 @@ EOF; } elseif (isset($test['todo']) && $test['todo']) { // TODO } else { - $expected = eval('return '.trim($test['php']).';'); + eval('$expected = '.trim($test['php']).';'); $this->assertEquals($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']); } diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index c7d3b071e6..07e6222d7e 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -62,9 +62,9 @@ class ParserTest extends \PHPUnit_Framework_TestCase if (isset($test['todo']) && $test['todo']) { // TODO } else { - $expected = var_export(eval('return '.trim($test['php']).';'), true); + eval('$expected = '.trim($test['php']).';'); - $tests[] = array($file, $expected, $test['yaml'], $test['test']); + $tests[] = array($file, var_export($expected, true), $test['yaml'], $test['test']); } } } From d014dacce3f757f2d39d1f7a8ba31d7e6ee8a384 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 4 Mar 2014 17:47:46 +0100 Subject: [PATCH 2/2] made Cookie stringification more robust --- src/Symfony/Component/BrowserKit/Cookie.php | 2 +- .../Component/HttpKernel/DataCollector/RequestDataCollector.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 02194a14bf..0b769c520d 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -96,7 +96,7 @@ class Cookie throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires); } - $cookie .= '; expires='.substr($dateTime->format(self::$dateFormats[0]), 0, -5); + $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0])); } if ('' !== $this->domain) { diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 4473605e84..be08e305a2 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -304,7 +304,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter } } - $cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5); + $cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T')); } if ($domain) {