Edit report at http://bugs.php.net/bug.php?id=51819&edit=1

 ID:               51819
 Updated by:       fel...@php.net
 Reported by:      shumisha at gmail dot com
 Summary:          Case discrepancy in timezone names cause Uncaught
                   exception and fatal error
-Status:           Open
+Status:           Assigned
 Type:             Bug
 Package:          Date/time related
 Operating System: linux/windows
 PHP Version:      5.2.13
-Assigned To:      
+Assigned To:      derick



Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to