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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC