bug #17835 [Yaml] fix default timezone to be UTC (xabbuh)
This PR was merged into the 2.3 branch.
Discussion
----------
[Yaml] fix default timezone to be UTC
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
e9ee877
[Yaml] fix default timezone to be UTC
This commit is contained in:
commit
5fda221d47
|
@ -475,7 +475,12 @@ class Inline
|
|||
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;
|
||||
|
|
|
@ -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' =>
|
||||
|
@ -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
|
||||
)
|
||||
---
|
||||
|
|
|
@ -202,7 +202,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
|||
"'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),
|
||||
|
|
Reference in New Issue