Bug #80057 [NEW]: DateTimeImmutable::createFromFormat() does not populate time

From: Date: Fri, 04 Sep 2020 10:16:58 +0000
Subject: Bug #80057 [NEW]: DateTimeImmutable::createFromFormat() does not populate time
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228880@lists.php.net to get a copy of this message
From: bc at benjamin-cremer dot de Operating system: linux PHP version: 8.0.0beta3 Package: Date/time related Bug Type: Bug Bug description:DateTimeImmutable::createFromFormat() does not populate time Description: ------------ The current time is not populated when a DateTime object is created by createFromFormat with a format pattern that has no time part defined. Given the following code: var_dump(DateTimeImmutable::createFromFormat('Y-m-d', '2020-09-04')); Output from 8.0.0beta2 and before: object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2020-09-04 10:28:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Output from 8.0.0beta3: object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2020-09-04 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Test script: --------------- <?php var_dump(DateTimeImmutable::createFromFormat('Y-m-d', '2020-09-04')->format('His') > 0); Expected result: ---------------- bool(true) Actual result: -------------- bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=80057&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80057&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80057&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80057&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80057&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80057&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80057&r=support Expected behavior: https://bugs.php.net/fix.php?id=80057&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80057&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80057&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80057&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80057&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80057&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80057&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80057&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80057&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80057&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80057&r=mysqlcfg

« previous php.bugs (#228880) next »