Bug #66845 [ReO->Nab]: timezone_open

From: Date: Fri, 07 Mar 2014 15:17:27 +0000
Subject: Bug #66845 [ReO->Nab]: timezone_open
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184608@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66845&edit=1 ID: 66845 Updated by: derick@php.net Reported by: thekid@php.net Summary: timezone_open -Status: Re-Opened +Status: Not a bug Type: Bug Package: Date/time related Operating System: Windows 7 PHP Version: 5.6.0alpha3 Block user comment: N Private report: N New Comment: Abbreviations are only for display purposes. Do not do calculations with them. CEST doesn't necessarily always mean the same. The example is better with "EDT" as that is used in locations with different UTC offsets (US, Australia f.e.). The project where this caused problems for you, should never have used $last['abbr']. Previous Comments: ------------------------------------------------------------------------ [2014-03-07 14:50:09] thekid@php.net @derick - what you can't see as my reproducing script doesn't include it is that the "deprecated" identifier is returned from a call to timezone_transitions_get() in the first place: php -ddate.timezone=Europe/Berlin -r 'var_dump(timezone_transitions_get(timezone_open("Europe/Berlin")));' array(145) { ... [143]=> array(5) { ["ts"]=> int(2121901200) ["time"]=> string(24) "2037-03-29T01:00:00+0000" ["offset"]=> int(7200) ["isdst"]=> bool(true) ["abbr"]=> string(4) "CEST" } [144]=> array(5) { ["ts"]=> int(2140045200) ["time"]=> string(24) "2037-10-25T01:00:00+0000" ["offset"]=> int(3600) ["isdst"]=> bool(false) ["abbr"]=> string(3) "CET" } } One could regard this as a bug in that function then. ------------------------------------------------------------------------ [2014-03-07 14:39:39] derick@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Yes, this is a bug fix. If you want to use Europe/Berlin, you need to use Europe/Berlin. PHP 5.6 adds supports for using "type 1" (+03:00) and "type 2" (CEST/CET) as timezone object, where previously PHP wanted to be nice and allow the use of the deprecated abbreviations to be "upgraded" to Timezone Identifiers. ------------------------------------------------------------------------ [2014-03-07 13:33:10] thekid@php.net Description: ------------ timezone_open() behaviour has changed between PHP 5.5 and PHP 5.6 Test script: --------------- $ php -ddate.timezone=Europe/Berlin -r 'var_dump(timezone_open("CEST"));' Expected result: ---------------- object(DateTimeZone)#1 (2) { ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" } Actual result: -------------- object(DateTimeZone)#1 (2) { ["timezone_type"]=> int(2) ["timezone"]=> string(4) "CEST" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66845&edit=1

« previous php.bugs (#184608) next »