Edit report at http://bugs.php.net/bug.php?id=51819&edit=1
ID: 51819 Updated by: bj...@php.net Reported by: shumisha at gmail dot com Summary: Case discrepancy in timezone names cause Uncaught exception and fatal error -Status: Assigned +Status: Closed Type: Bug Package: Date/time related Operating System: linux/windows PHP Version: 5.2.13 -Assigned To: derick +Assigned To: bjori Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed in 5.3 & 5.4 Previous Comments: ------------------------------------------------------------------------ [2011-06-05 15:30:05] bj...@php.net Automatic comment from SVN on behalf of bjori Revision: http://svn.php.net/viewvc/?view=revision&revision=311831 Log: Fixed bug#51819 (Case discrepancy in timezone names cause Uncaught exception and fatal error) ------------------------------------------------------------------------ [2010-07-18 01:20:27] k.schroe...@php.net Automatic comment from SVN on behalf of k.schroeder Revision: http://svn.php.net/viewvc/?view=revision&revision=301360 Log: Test for #51819 ------------------------------------------------------------------------ [2010-05-14 10:10:07] shumisha at gmail dot com Description: ------------ Hi There seem to be a discrepency for timezones names as reported by timezone_abbreviations_list() and the DateTime object parser. We have found a (small) numbre of timezones for which this happens: Been reported and reproduced with PHP 5.1.41 adn PHP 5.2.13 Test script: --------------- 1 - Get identifiers list: $all = timezone_abbreviations_list(); The resulting array contains, for instance: [54] => Array ( [dst] => [offset] => 36000 [timezone_id] => Australia/NSW ) 2 - Use this timezone_id to create a DateTimeObject $dateString = "2010-05-15 00:00:00 Australia/NSW"; $date = new DateTime( $dateString); Expected result: ---------------- A DateTime object created The above code runs without problem if timezone identifier (Australia/NSW) is replaced by Australia/Nsw. I have found the following timezones to have the same issue: Australia/ACT NZ-CHAT America/Know_IN Australia/LHI Chile/EasterIsland Europe/Isle_of_Man In others, all timezones names that do not follow camelcase strictly. There are probably others. Actual result: -------------- Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [datetime.--construct]: Failed to parse time string (2010-05-15 00:00:00 Australia/NSW) at position 20 (A): The timezone could not be found in the database' in /XXXX/test.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51819&edit=1