Merge branch '2.1'

* 2.1:
  bumped Symfony version to 2.1.7-DEV
  updated VERSION for 2.1.6
  updated CHANGELOG for 2.1.6
  [Form] Fix for `DateTimeToStringTransformer`

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
This commit is contained in:
Fabien Potencier 2012-12-23 19:21:21 +01:00
commit e9d0bc24cb
3 changed files with 28 additions and 13 deletions

View File

@ -7,6 +7,11 @@ in 2.1 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.1.0...v2.1.1
* 2.1.6 (2012-12-21)
* b8e5689: [FrameworkBundle] fixed ESI calls
* ce536cd: [FrameworkBundle] fixed ESI calls
* 2.1.5 (2012-12-20)
* 532cc9a: [FrameworkBundle] added support for URIs as an argument to HttpKernel::render()

View File

@ -42,7 +42,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
/**
* Whether to parse by appending a pipe "|" to the parse format.
*
* This only works as of PHP 5.3.8.
* This only works as of PHP 5.3.7.
*
* @var Boolean
*/
@ -66,9 +66,10 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
$this->generateFormat = $this->parseFormat = $format;
// The pipe in the parser pattern only works as of PHP 5.3.8
// The pipe in the parser pattern only works as of PHP 5.3.7
// See http://bugs.php.net/54316
$this->parseUsingPipe = null === $parseUsingPipe
? version_compare(phpversion(), '5.3.8', '>=')
? version_compare(phpversion(), '5.3.7', '>=')
: $parseUsingPipe;
// See http://php.net/manual/en/datetime.createfromformat.php
@ -151,7 +152,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
);
}
// On PHP versions < 5.3.8 we need to emulate the pipe operator
// On PHP versions < 5.3.7 we need to emulate the pipe operator
// and reset parts not given in the format to their equivalent
// of the UNIX base timestamp.
if (!$this->parseUsingPipe) {

View File

@ -17,7 +17,7 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
{
public function dataProvider()
{
return array(
$data = array(
array('Y-m-d H:i:s', '2010-02-03 16:05:06', '2010-02-03 16:05:06 UTC'),
array('Y-m-d H:i:00', '2010-02-03 16:05:00', '2010-02-03 16:05:00 UTC'),
array('Y-m-d H:i', '2010-02-03 16:05', '2010-02-03 16:05:00 UTC'),
@ -33,10 +33,12 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
// different day representations
array('Y-m-j', '2010-02-3', '2010-02-03 00:00:00 UTC'),
array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC'),
array('z', '33', '1970-02-03 00:00:00 UTC'),
// not bijective
// this will not work as php will use actual date to replace missing info
// and after change of date will lookup for closest Wednesday
// i.e. value: 2010-02, php value: 2010-02-(today i.e. 20), parsed date: 2010-02-24
//array('Y-m-D', '2010-02-Wed', '2010-02-03 00:00:00 UTC'),
//array('Y-m-l', '2010-02-Wednesday', '2010-02-03 00:00:00 UTC'),
@ -56,6 +58,13 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
// seconds since unix
array('U', '1265213106', '2010-02-03 16:05:06 UTC'),
);
// This test will fail < 5.3.9 - see https://bugs.php.net/51994
if (version_compare(phpversion(), '5.3.9', '>=')) {
$data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC');
}
return $data;
}
/**
@ -100,8 +109,12 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
/**
* @dataProvider dataProvider
*/
public function testReverseTransformBeforePhp538($format, $input, $output)
public function testReverseTransformUsingPipe($format, $input, $output)
{
if (version_compare(phpversion(), '5.3.7', '>=')) {
$this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
}
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, false);
$output = new \DateTime($output);
@ -112,13 +125,9 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
/**
* @dataProvider dataProvider
*/
public function testReverseTransformAsOfPhp538($format, $input, $output)
public function testReverseTransformWithoutUsingPipe($format, $input, $output)
{
if (version_compare(phpversion(), '5.3.8', '<')) {
$this->markTestSkipped('Requires PHP 5.3.8 or newer');
}
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format);
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, false);
$output = new \DateTime($output);