Skip to content

Commit 4ddb0fb

Browse files
committed
Merge branch '2.1' into 2.2
* 2.1: Fix default value handling for multi-value options [HttpKernel] truncate profiler token to 6 chars (see #7665) Disabled APC on Travis for PHP 5.5+ as it is not available [HttpFoundation] do not use server variable PATH_INFO because it is already decoded and thus symfony is fragile to double encoding of the path [Yaml] improved boolean naming ($notEOF -> !$EOF) [Yaml] fixed handling an empty value [Routing][XML Loader] Add a possibility to set a default value to null The /e modifier for preg_replace() is deprecated in PHP 5.5; replace with preg_replace_callback() [HttpFoundation] Fixed bug in key searching for NamespacedAttributeBag [Form] DateTimeToRfc3339Transformer use proper transformation exteption in reverse transformation Update PhpEngine.php [HttpFoundation] getClientIp is fixed. Conflicts: .travis.yml src/Symfony/Component/Routing/Loader/XmlFileLoader.php src/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
2 parents 0e0a1ba + 75682f2 commit 4ddb0fb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ public function reverseTransform($rfc3339)
5353
return null;
5454
}
5555

56-
$dateTime = new \DateTime($rfc3339);
56+
try {
57+
$dateTime = new \DateTime($rfc3339);
58+
} catch (\Exception $e) {
59+
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
60+
}
5761

5862
if ($this->outputTimezone !== $this->inputTimezone) {
5963
try {

Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,14 @@ public function testReverseTransformWithNonExistingDate()
119119

120120
$transformer->reverseTransform('2010-04-31T04:05Z');
121121
}
122+
123+
/**
124+
* @expectedException Symfony\Component\Form\Exception\TransformationFailedException
125+
*/
126+
public function testReverseTransformExpectsValidDateString()
127+
{
128+
$transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
129+
130+
$transformer->reverseTransform('2010-2010-2010');
131+
}
122132
}

0 commit comments

Comments
 (0)