Bug #80308 [NEW]: strtotime() issue with Nov 1st
| From: | bruno at leveque dot io | Date: | Mon, 02 Nov 2020 22:45:07 +0000 |
| Subject: | Bug #80308 [NEW]: strtotime() issue with Nov 1st | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-230068@lists.php.net to get a copy of this message | ||
From: bruno at leveque dot io
Operating system: Ubuntu 20.04.1 LTS
PHP version: 7.4.12
Package: *General Issues
Bug Type: Bug
Bug description:strtotime() issue with Nov 1st
Description:
------------
strtotime() is encountering issues when dealing with Nov 1st, 2020
specifically.
- Adding 2 x 86400 seconds to Nov 1st will actually return Nov 2nd
- Adding '+2 days' to the same date returns Nov 3rd
This issue does not happen with any other date.
Test script:
---------------
<?php
/* Add 2 days to Oct 1st
** Outputs 2020-10-03 - Correct
*/
echo strftime('%Y-%m-%d', strtotime('2020-10-01') + (2 * 86400))."\n";
/* Add 2 days to Nov 1st
** Outputs 2020-11-02 - Bug
*/
echo strftime('%Y-%m-%d', strtotime('2020-11-01') + (2 * 86400))."\n";
/* Add 2 days to Nov 1st
** Outputs 2020-11-03 - Correct
*/
echo strftime('%Y-%m-%d', strtotime('2020-11-01 + 2 days'))."\n";
Expected result:
----------------
2020-10-03
2020-11-03
2020-11-03
Actual result:
--------------
2020-10-03
2020-11-02
2020-11-03
--
Edit bug report at https://bugs.php.net/bug.php?id=80308&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80308&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80308&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80308&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80308&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80308&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80308&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80308&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80308&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80308&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80308&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80308&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80308&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80308&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80308&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80308&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80308&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80308&r=mysqlcfg