From:             glen at delfi dot ee
Operating system: PLD Linux
PHP version:      5.2.9
PHP Bug Type:     Feature/Change Request
Bug description:  mktime should return -1 or false on invalid args, but returns 
943912800

Description:
------------
http://php.net/mktime

"mktime() returns the Unix timestamp of the arguments given. If the 
arguments are invalid, the function returns FALSE (before PHP 5.1 it 
returned -1)."

but it returns "Tue Nov 30 00:00:00 1999 +0200" instead when invalid 
input like null (or undefined) is used:

php -r 'echo mktime(0, 0, 0, null, null, null), "\n";'
943912800

ok, i understand if all params are 0, then it would make sense:

"The number of the year, may be a two or four digit value, with 
values between 0-69 mapping to 2000-2069 and 70-100 to 1970-2000. On 
systems where time_t is a 32bit signed integer, as most common 
today, the valid range for year is somewhere between 1901 and 2038. 
However, before PHP 5.1.0 this range was limited from 1970 to 2038 
on some systems (e.g. Windows)."

Year as 0 is 2000,
Month 0 is calculated as 12 of the last year, thus it gets December 
and 0 December is 30 November

please make using undefined variables and nulls being invalid input 
(so that you must cast to int, to treat empty input as 0):

php -r 'echo mktime(0, 0, 0, (int )$_GET['day'], 
(int )$_GET['month'], (int )$_GET['year']), "\n";'



-- 
Edit bug report at http://bugs.php.net/?id=47806&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47806&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47806&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47806&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47806&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47806&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47806&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47806&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47806&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47806&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47806&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47806&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47806&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47806&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47806&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47806&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47806&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47806&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47806&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47806&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47806&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47806&r=mysqlcfg

Reply via email to