ID: 48334 Updated by: der...@php.net Reported By: tom at ix dot tc -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Windows Vista PHP Version: 5.2.9 New Comment:
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 This is not a bug, it is parsed like this: php -r 'var_dump(date_parse( "East Anglia" ));' As you can see it sees "EAST" as timezone, and Anglia as "double timezone"... the parser ignores this second timezone specification because in some cases you see "CEST GMT+02". Previous Comments: ------------------------------------------------------------------------ [2009-05-19 15:53:23] tom at ix dot tc Description: ------------ I was initialising DateTime objects to test validity of date strings when I came across an odd bug. The string "East Anglia" gets parsed the same way as some time today. Strangely, strtotime does not parse the string. Reproduce code: --------------- $date = new DateTime('AAAAA'); echo $date->format('U'); will correctly throw an exception: Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: Failed to parse time string (AAA) at position 0 (A): $date = new DateTime('East Anglia'); echo $date->format('U'); Gets parsed as if it were now + 7 hours. Expected result: ---------------- An exception: Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: Failed to parse time string (AAA) at position 0 (A): Actual result: -------------- Gets parsed as a time string. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48334&edit=1