Bug #80409 [NEW]: DateTime::modify() loses time with 'weekday' parameter

From: Date: Tue, 24 Nov 2020 10:05:29 +0000
Subject: Bug #80409 [NEW]: DateTime::modify() loses time with 'weekday' parameter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230563@lists.php.net to get a copy of this message
From: karol dot piotr dot kolanko at gmail dot com Operating system: Linux PHP version: 7.4.12 Package: Date/time related Bug Type: Bug Bug description:DateTime::modify() loses time with 'weekday' parameter Description: ------------ DateTime::modify() with parametrem 'weekday' loses time value. Also date() function. Test script: --------------- <?php $date = '2020-11-27 12:33:00'; echo date('Y-m-d H:i:s', strtotime($date.' +1 day')); // Correct: 2020-11-28 12:33:00 echo date('Y-m-d H:i:s', strtotime($date.' +1 Weekday')); // Uncorrect, lost time: 2020-11-30 00:00:00 $date1 = new DateTime($date); $date2 = new DateTime($date); $date2->modify('+1 day'); echo $date2->format('Y-m-d H:i:s'); // Correct: 2020-11-28 12:33:00 $date1->modify('+1 weekday'); echo $date1->format('Y-m-d H:i:s'); // Uncorrect, lost time: 2020-11-30 00:00:00 -- Edit bug report at https://bugs.php.net/bug.php?id=80409&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80409&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80409&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80409&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80409&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80409&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80409&r=support Expected behavior: https://bugs.php.net/fix.php?id=80409&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80409&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80409&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80409&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80409&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80409&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80409&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80409&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80409&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80409&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80409&r=mysqlcfg

« previous php.bugs (#230563) next »