Bug #78778 [NEW]: DateTime constructor and createFromFormat behaves differently

From: Date: Mon, 04 Nov 2019 11:45:38 +0000
Subject: Bug #78778 [NEW]: DateTime constructor and createFromFormat behaves differently
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223559@lists.php.net to get a copy of this message
From: boan at jfmedier dot dk Operating system: PHP version: 7.2.24 Package: Date/time related Bug Type: Bug Bug description:DateTime constructor and createFromFormat behaves differently Description: ------------ I would expect that the factory method createFromFormat should work like the constructor parameter. Test script: --------------- $date = new DateTimeImmutable('2019-11-01T12:12:40.8859136+00:00'); var_dump($date); $date = DateTimeImmutable::createFromFormat(DateTimeInterface::RFC3339_EXTENDED, '2019-11-01T12:12:40.8859136+00:00'); var_dump($date); Expected result: ---------------- object(DateTimeImmutable) { ["date"]=> string(26) "2019-11-01 12:12:40.885913" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } object(DateTimeImmutable) { ["date"]=> string(26) "2019-11-01 12:12:40.885913" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } Actual result: -------------- object(DateTimeImmutable) { ["date"]=> string(26) "2019-11-01 12:12:40.885913" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=78778&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78778&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78778&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78778&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78778&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78778&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78778&r=support Expected behavior: https://bugs.php.net/fix.php?id=78778&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78778&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78778&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78778&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78778&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78778&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78778&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78778&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78778&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78778&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78778&r=mysqlcfg

« previous php.bugs (#223559) next »