From:             mehdi dot rande at gmail dot com
Operating system: Linux
PHP version:      5.2.10
PHP Bug Type:     Date/time related
Bug description:  $date->modify('+ 1 '. $date->format('l')) == $date 

Description:
------------
Since php 5.2.9 modify function behaviour have change, in both case "next
$weekday" always go to the next specified weekday ("next weekday" >
"today"), but in 5.2.9 and 5.2.10 "+1 $weekday" go to the first encoutered
specified weekday including today ("next weekday" >= "today"). 

The behaviour of older php versions seems more logical to me, '+1' should
have the same behaviour than 'next'.

Reproduce code:
---------------
// Since php 5.2.9
$date  = new Datetime("2009-06-01");
$date->modify("+1 ".$date->format("l")); // == ('+1 monday')
echo $date->format("Y-m-d")."\n"; 
$date->modify("next ".$date->format("l")); // == ('next monday')
echo $date->format("Y-m-d")."\n"; 


Expected result:
----------------
2009-06-08
2009-06-08

Actual result:
--------------
2009-06-01
2009-06-08

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

Reply via email to