Bug #67080 [NEW]: Failed to parse time string (13/04/2014)

From: Date: Tue, 15 Apr 2014 16:40:51 +0000
Subject: Bug #67080 [NEW]: Failed to parse time string (13/04/2014)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185258@lists.php.net to get a copy of this message
From: jarcodallo at gmail dot com Operating system: Linux / Windows PHP version: 5.4.27 Package: Date/time related Bug Type: Bug Bug description:Failed to parse time string (13/04/2014) Description: ------------ I try convert string '13/04/2014' to DateTime Object, but this method "new DateTime('13/04/2014');", return Failed to parse time string (13/04/2014) at position 0 (1): Unexpected character. Try other dates and after this there is no problem, hope you can help me Test script: --------------- $date1 = new DateTime('12/04/2014'); var_dump($date1); $date2 = new DateTime('13/04/2014'); var_dump($date2); Expected result: ---------------- object(DateTime)[1] public 'date' => string '2014-12-04 00:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) object(DateTime)[1] public 'date' => string '2014-12-04 00:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) object(DateTime)[1] public 'date' => string '2014-13-04 00:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) object(DateTime)[1] public 'date' => string '2014-13-04 23:59:59' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) Actual result: -------------- object(DateTime)[1] public 'date' => string '2014-12-04 00:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) object(DateTime)[1] public 'date' => string '2014-12-04 00:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (13/04/2014) at position 0 (1): Unexpected character' in D:\wamp\www\tools\bug-datetime.php on line 8 Exception: DateTime::__construct(): Failed to parse time string (13/04/2014) at position 0 (1): Unexpected character in D:\wamp\www\tools\bug-datetime.php on line 8 Call Stack # Time Memory Function Location 1 0.0000 146168 {main}( ) ..\bug-datetime.php:0 2 0.0156 147456 __construct ( ) ..\bug-datetime.php:8 -- Edit bug report at https://bugs.php.net/bug.php?id=67080&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67080&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67080&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67080&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67080&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67080&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67080&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67080&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67080&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67080&r=support Expected behavior: https://bugs.php.net/fix.php?id=67080&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67080&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67080&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67080&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67080&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67080&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67080&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67080&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67080&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67080&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67080&r=mysqlcfg

« previous php.bugs (#185258) next »