From:
Operating system: linux/windows
PHP version: 5.2.13
Package: Date/time related
Bug Type: Bug
Bug description:Case discrepancy in timezone names cause Uncaught exception and
fatal error
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 bug report at http://bugs.php.net/bug.php?id=51819&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51819&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51819&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51819&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51819&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51819&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51819&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51819&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51819&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51819&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51819&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51819&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51819&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51819&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51819&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51819&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51819&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51819&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51819&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51819&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51819&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51819&r=mysqlcfg