php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #35558 mktime interpreting 3 digit differently
Submitted: 2005-12-05 17:17 UTC Modified: 2005-12-05 18:27 UTC
From: marcel at daxy dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.1.1 OS: Linux 2.6.9
Private report: No CVE-ID: None
 [2005-12-05 17:17 UTC] marcel at daxy dot net
Description:
------------
localtime returns years after 1900, so for 2005 it's 105.
When using this number back into mktime it returns FALSE with 5.1.1. When using 5.0.x it returns the correct value. Try running the code at "Reproduce code" with both 5.1 and 5.0.

This is expected behavior, but due to backwards compatibility it would be nice to have this interpreted differently.

Reproduce code:
---------------
<?
$ltime = localtime(time(), true);
print mktime (0,0,0,0,0,$ltime['tm_year']);
?>

Expected result:
----------------
Because of the behavior of localtime it would be nice to have the correct value returned with mktime


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-05 18:27 UTC] iliaa@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC