|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28024 Changed behavior of strtotime()
Submitted: 2004-04-16 10:30 UTC Modified: 2005-06-18 21:35 UTC
Avg. Score:3.7 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: lars at jvinformatik dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5CVS, 4CVS (2004-04-16) OS: Linux
Private report: No CVE-ID: None
 [2004-04-16 10:30 UTC] lars at jvinformatik dot com
The new version of strtotime fails to parse some strings that worked in previous versions.

strtotime("17:00 2004-01-01") used to return 1072972800 in PHP 4.2.0 but returns -1 in 4.3.6.

If the order of the string is reversed to "2004-01-01 17:00" it works fine in 4.3.6 so it's really not that serious, but it probably will break some old applications that use the incorrect order.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-16 15:06 UTC]

 [2004-04-16 16:33 UTC]
Will have a look at this one too.
 [2004-11-24 00:29 UTC] toro at equillia dot com
I found that the behaviour changed between 4.3.5 and 4.3.6. So strtotime worked one way in 4.3.5 and when I upgraded to 4.3.6 the behaviour changed. As mentioned above it is just matter of rearranging the string that is passed to strtotime to get the same result. 

If it is decided to do something about this then I guess as long as any changes incorporate the new behaviour as well as the old behaviour then the changes won't effect people who are accustom to the new behaviour.
 [2004-11-24 02:43 UTC] toro at equillia dot com
I've just done a bit of testing on 4.3.9 and 4.3.5 and from what I can tell the new behaviour is a subset of the old behaviour so you can disregard the second sentence from my comment above.
 [2004-11-24 02:44 UTC] toro at equillia dot com
Sorry, I ment second paragraph.
 [2004-11-24 09:09 UTC]
The string parsing routines are very complex and this change was definitely not done deliberately.
 [2005-06-18 21:35 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Fixed for PHP 5.1.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 28 12:01:24 2020 UTC