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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Sun May 05 15:01:33 2024 UTC