Bug #79926 [NEW]: `DateTime::createFromFormat`: `H` overflows to next same *weekday* for D-format

From: Date: Mon, 03 Aug 2020 20:23:12 +0000
Subject: Bug #79926 [NEW]: `DateTime::createFromFormat`: `H` overflows to next same *weekday* for D-format
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228394@lists.php.net to get a copy of this message
From: thomas at landauer dot at Operating system: Linux PHP version: 7.2.32 Package: Date/time related Bug Type: Bug Bug description:DateTime::createFromFormat: H overflows to next same *weekday* for D-format Description: ------------ As I learned from https://bugs.php.net/bug.php?id=67921 it is the expected behavior for an hour between 24 and 99 to just overflow to the next day: var_dump(DateTime::createFromFormat('H:m', '25:00')); gives me tomorrow at 01:00 - that's OK. However, if I use one of the formats that start with 'D', the hour doesn't overflow to the next day, but to the next (e.g.) *Monday* (i.e. same weekday of the next week): Test script: --------------- var_dump(DateTime::createFromFormat(DateTime::RFC822, 'Mon, 3 Aug 20 25:00:00 +0000')); var_dump(DateTime::createFromFormat(DateTime::RFC1036, 'Mon, 3 Aug 20 25:00:00 +0000')); var_dump(DateTime::createFromFormat(DateTime::RFC1123, 'Mon, 3 Aug 20 25:00:00 +0000')); var_dump(DateTime::createFromFormat(DateTime::RFC7231, 'Mon, 3 Aug 20 25:00:00 GMT')); var_dump(DateTime::createFromFormat(DateTime::RFC2822, 'Mon, 3 Aug 2020 25:00:00 +0000')); var_dump(DateTime::createFromFormat(DateTime::RSS, 'Mon, 3 Aug 2020 25:00:00 +0000')); Expected result: ---------------- 4 Aug 2020 01:00 Actual result: -------------- 10 Aug 2020 01:00 -- Edit bug report at https://bugs.php.net/bug.php?id=79926&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79926&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79926&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79926&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79926&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79926&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79926&r=support Expected behavior: https://bugs.php.net/fix.php?id=79926&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79926&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79926&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79926&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79926&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79926&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79926&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79926&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79926&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79926&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79926&r=mysqlcfg

« previous php.bugs (#228394) next »