php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75265 Returnvalue from strtotime doesn't always return false on errors
Submitted: 2017-09-27 09:00 UTC Modified: 2017-09-27 09:03 UTC
From: sven dot kaegi at intellicard dot ch Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: Irrelevant
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sven dot kaegi at intellicard dot ch
New email:
PHP Version: OS:

 

 [2017-09-27 09:00 UTC] sven dot kaegi at intellicard dot ch
Description:
------------
---
From manual page: http://www.php.net/function.strtotime
---

It seems that if you call strtotime with two parameters like this:

strtotime("+1 day","27.09.2017");

The return value is a timestamp pointing to the 2nd of January 1970.
As I didn't use as a second paramater a valid timestamp this should - according to the documentation - return false instead of a valid timestamp.


Test script:
---------------
if(strtotime("+1 day","27.09.2017")!==false)
{
  echo "Illegal return value";
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-27 09:03 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: Scripting Engine problem +Package: Date/time related
 [2017-09-27 09:03 UTC] requinix@php.net
The second argument is an int so "27.09.2017" was converted to the int 27.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 15:01:35 2025 UTC