Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #35558 : mktime interpreting 3 digit differently
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 29th April 19:03
php-bugs
External User
 
Posts: 1
Default #35558 : mktime interpreting 3 digit differently



From: marcel at daxy dot net
Operating system: Linux 2.6.9
PHP version: 5.1.1
PHP Bug Type: Date/time related
Bug description: mktime interpreting 3 digit differently

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


--
Edit bug report at http://bugs.php.net/?id=35558&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35558&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35558&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35558&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35558&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35558&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35558&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35558&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35558&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35558&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35558&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35558&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35558&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35558&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35558&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35558&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35558&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35558&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35558&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35558&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35558&r=mysqlcfg
  Reply With Quote


  sponsored links


2 29th April 19:04
External User
 
Posts: 1
Default #35558 : mktime interpreting 3 digit differently



ID: 35558
Updated by: iliaa@php.net
Reported By: marcel at daxy dot net
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Linux 2.6.9
PHP Version: 5.1.1
New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2005-12-05 17:17:42] 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

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=35558&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666