php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74517 Incorrect date string to int conversion
Submitted: 2017-05-01 00:10 UTC Modified: 2017-05-01 07:14 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: apollo880 at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: All systems
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: apollo880 at gmail dot com
New email:
PHP Version: OS:

 

 [2017-05-01 00:10 UTC] apollo880 at gmail dot com
Description:
------------
An incorrect date string to int conversion in strtotime() with use the YYYY-MM-DD format

Test script:
---------------
echo strtotime('1996-12-01') // return 849387600, it's OK
echo strtotime('1996-11-31') // return 849387600, it's FAIL, this date not exists, need return false 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-01 07:14 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: *General Issues +Package: Date/time related
 [2017-05-01 07:14 UTC] requinix@php.net
strtotime will try to come up with the most reasonable date it can from the string passed. Dates with invalid month or day numbers will underflow or overflow.

If you want validation then use DateTime and its getLastErrors().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC