Bug #78827 [NEW]: Wrong timestamp

From: Date: Sun, 17 Nov 2019 21:22:49 +0000
Subject: Bug #78827 [NEW]: Wrong timestamp
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223769@lists.php.net to get a copy of this message
From: obreham at gmail dot com Operating system: Ubuntu 16.04.6 LTS PHP version: 7.3.11 Package: Calendar related Bug Type: Bug Bug description:Wrong timestamp Description: ------------ --- From manual page: https://php.net/function.strftime --- When adding a time interval to 'last Sunday' on a Sunday, you get an incorrect timestamp when interval is longer than a week. 'last Sunday' becomes 'this Sunday'. Test script: --------------- /* Example code was run on Sunday Nov 17, 2019 */ var_dump( $saturday = strtotime('last Saturday'), (strtotime('last Saturday + 1 day') - $saturday) / 86400, (strtotime('last Saturday + 2 day') - $saturday) / 86400, (strtotime('last Saturday + 3 day') - $saturday) / 86400, (strtotime('last Saturday + 4 day') - $saturday) / 86400, (strtotime('last Saturday + 5 day') - $saturday) / 86400, (strtotime('last Saturday + 6 day') - $saturday) / 86400, (strtotime('last Saturday + 7 day') - $saturday) / 86400, (strtotime('last Saturday + 8 day') - $saturday) / 86400, (strtotime('last Saturday + 9 day') - $saturday) / 86400, $sunday = strtotime('last Sunday'), (strtotime('last Sunday + 1 day') - $sunday) / 86400, (strtotime('last Sunday + 2 day') - $sunday) / 86400, (strtotime('last Sunday + 3 day') - $sunday) / 86400, (strtotime('last Sunday + 4 day') - $sunday) / 86400, (strtotime('last Sunday + 5 day') - $sunday) / 86400, (strtotime('last Sunday + 6 day') - $sunday) / 86400, (strtotime('last Sunday + 7 day') - $sunday) / 86400, (strtotime('last Sunday + 8 day') - $sunday) / 86400, (strtotime('last Sunday + 9 day') - $sunday) / 86400, $monday = strtotime('last Monday'), (strtotime('last Monday + 1 day') - $monday) / 86400, (strtotime('last Monday + 2 day') - $monday) / 86400, (strtotime('last Monday + 3 day') - $monday) / 86400, (strtotime('last Monday + 4 day') - $monday) / 86400, (strtotime('last Monday + 5 day') - $monday) / 86400, (strtotime('last Monday + 6 day') - $monday) / 86400, (strtotime('last Monday + 7 day') - $monday) / 86400, (strtotime('last Monday + 8 day') - $monday) / 86400, (strtotime('last Monday + 9 day') - $monday) / 86400 ); Expected result: ---------------- int(1573880400) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(1573362000) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(1573448400) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) Actual result: -------------- int(1573880400) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(1573362000) int(1) int(2) int(3) int(4) int(5) int(6) int(14) int(15) int(16) int(1573448400) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) -- Edit bug report at https://bugs.php.net/bug.php?id=78827&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78827&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78827&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78827&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78827&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78827&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78827&r=support Expected behavior: https://bugs.php.net/fix.php?id=78827&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78827&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78827&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78827&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78827&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78827&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78827&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78827&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78827&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78827&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78827&r=mysqlcfg

« previous php.bugs (#223769) next »