php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38481 strtotime return invalid timestamp (if input value is timestamp)
Submitted: 2006-08-17 11:01 UTC Modified: 2006-08-17 11:30 UTC
From: oleg at programstar dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.4 OS: Fedora 4.1
Private report: No CVE-ID: None
 [2006-08-17 11:01 UTC] oleg at programstar dot com
Description:
------------
I’ve found a bug in strtotime() function.
The present function does not return anything if you transmit unix_timestamp as a function parameter. However, if the last four digits of the value compose a valid year value, the function tries to calculate the whole date with the last 5 digits. Probably it fails there so it returns unix_timestamp the dates with the day and month equal to the current one, as far as the year goes, it is the one that the function has detected in the timestamp primary value. 

Example: 
Primary value: 1136412001 (January, 5, 2006)
On return: 998037401 (August, 17, 2001)

This way, a standard plug-in Smarty uses this function to transform the UNIX_TIMESTAMP format data into any data value. 
PHP Version 5.1.4

Original here: http://hcjack.livejournal.com/322438.html (on russian)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-17 11:04 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

If you're still able to reproduce it - please provide short and complete reproduce script.
 [2006-08-17 11:21 UTC] tony2001@php.net
Actually, no need to try the snapshot, it's bogus.
The function was never intended to parse timestamps, it parses "string containing a US English date format".
 [2006-08-17 11:30 UTC] oleg at programstar dot com
Yes, certainly! But repetition - thereby function uses standart function date_format in Smarty.
Sorry for my bad English
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Dec 05 12:00:01 2025 UTC