minor #10380 fixed some HHVM bugs (fabpot)

This PR was merged into the 2.3 branch.

Discussion
----------

fixed some HHVM bugs

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

This is a workaround for facebook/hhvm#1161. I made the change as the workaround does the same thing and the eval is part of unit tests.

Commits
-------

d014dac made Cookie stringification more robust
fa24749 [Yaml] fix for a HHVM bug
This commit is contained in:
Fabien Potencier 2014-03-04 20:15:40 +01:00
commit 50579442f8
4 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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']);
}

View File

@ -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']);
}
}
}