Bug #54340 [NEW]: DateTime::add() method bug

From: Date: Mon, 21 Mar 2011 23:29:13 +0000
Subject: Bug #54340 [NEW]: DateTime::add() method bug
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159685@lists.php.net to get a copy of this message
From:             
Operating system: Windows 7 x64
PHP version:      5.3.6
Package:          *General Issues
Bug Type:         Bug
Bug description:DateTime::add() method bug

Description:
------------
DateTime::add() method bug

Test script:
---------------
$date = new DateTime('first day of this month');
echo $date->format('Y-m-d H:i:sP');
$date->add(new DateInterval('P1D'));
echo $date->format('Y-m-d H:i:sP');

Expected result:
----------------
2011-03-01 01:17:31+02:00
2011-03-02 01:17:31+02:00 
Actual result:
--------------
2011-03-01 01:17:31+02:00
2011-03-01 01:17:31+02:00 


=================
====== BUT ======
=================

$date = new DateTime('first day of this month');
echo $date->format('Y-m-d H:i:sP');
$date->add(new DateInterval('P1M'));
echo $date->format('Y-m-d H:i:sP');

Expected result:
----------------
2011-03-01 01:17:31+02:00
2011-04-01 01:17:31+02:00 
Actual result:
--------------
2011-03-01 01:17:31+02:00
2011-04-01 01:17:31+02:00 



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



Thread (3 messages)

« previous php.bugs (#159685) next »