Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Symfony/Component/Yaml/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,12 @@ private static function evaluateScalar($scalar, $references = array())
case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar):
return (float) str_replace(',', '', $scalar);
case preg_match(self::getTimestampRegex(), $scalar):
return strtotime($scalar);
$timeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$time = strtotime($scalar);
date_default_timezone_set($timeZone);

return $time;
}
default:
return (string) $scalar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ yaml: |
Billsmer @ 338-4338.
php: |
array(
'invoice' => 34843, 'date' => mktime(0, 0, 0, 1, 23, 2001),
'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'bill-to' =>
array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
, 'ship-to' =>
Expand Down Expand Up @@ -877,7 +877,7 @@ yaml: |
php: |
array(
'invoice' => 34843,
'date' => mktime(0, 0, 0, 1, 23, 2001),
'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'total' => 4443.52
)
---
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Yaml/Tests/InlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ protected function getTestsForParse()
"'on'" => 'on',
"'off'" => 'off',

'2007-10-30' => mktime(0, 0, 0, 10, 30, 2007),
'2007-10-30' => gmmktime(0, 0, 0, 10, 30, 2007),
'2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007),
'2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007),
'1960-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 1960),
Expand Down