Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/4394'
Browse files Browse the repository at this point in the history
Close #4394
Fixes #4393
  • Loading branch information
weierophinney committed May 2, 2013
2 parents 25e0265 + 9a0785b commit dd12afa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/Zend/Filter/DateTimeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public function filter($value)
*/
protected function normalizeDateTime($value)
{
if (is_int($value)) {
if (empty($value)) {
return $value;
} elseif (is_int($value)) {
$dateTime = new DateTime('@' . $value);
} elseif (!$value instanceof DateTime) {
$dateTime = new DateTime($value);
Expand Down
9 changes: 9 additions & 0 deletions tests/ZendTest/Filter/DateTimeFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ public function tearDown()
date_default_timezone_set($this->defaultTimezone);
}

public function testFormatterDoesNotFormatAnEmptyString()
{
date_default_timezone_set('UTC');

$filter = new DateTimeFormatter();
$result = $filter->filter('');
$this->assertEquals('', $result);
}

public function testDateTimeFormatted()
{
date_default_timezone_set('UTC');
Expand Down

0 comments on commit dd12afa

Please sign in to comment.