From:             for-bugs at hnw dot jp
Operating system: any
PHP version:      5.3.0alpha3
PHP Bug Type:     Date/time related
Bug description:  5.3.0alpha3's strtotime() returns inconsistent result with 
some relative items

Description:
------------
strtotime() of PHP 5.3.0alpha3 returns inconsistent and incompatible
result with 'first day' 'last day' 'previous week' 'next week'.

PHP 5.2.8 produces consistent result, and meaning of 'first' 'next' 'last'
'previous' is clear for me.

The behaviour of PHP 5.3.0's strtotime() is sometimes natural, but it
lacks consistency and documentation, I think.

Reproduce code:
---------------
<?php

var_dump(date("Y-m-d", strtotime("20081224 first day")));
var_dump(date("Y-m-d", strtotime("20081224 next day")));

var_dump(date("Y-m-d", strtotime("20081224 last day")));
var_dump(date("Y-m-d", strtotime("20081224 previous day")));

var_dump(date("Y-m-d", strtotime("20081224 first week")));
var_dump(date("Y-m-d", strtotime("20081224 next week")));

var_dump(date("Y-m-d", strtotime("20081224 last week")));
var_dump(date("Y-m-d", strtotime("20081224 previous week")));

Expected result:
----------------
string(10) "2008-12-25"
string(10) "2008-12-25"
string(10) "2008-12-23"
string(10) "2008-12-23"
string(10) "2008-12-31"
string(10) "2008-12-31"
string(10) "2008-12-17"
string(10) "2008-12-17"

Actual result:
--------------
string(10) "2008-12-01"
string(10) "2008-12-25"
string(10) "2008-12-31"
string(10) "2008-12-23"
string(10) "1970-01-01"
string(10) "2008-12-29"
string(10) "2008-12-15"
string(10) "2008-12-15"

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

Reply via email to