[Bug 805206] [NEW] php 5.3.2 is affected by a bug in the DateTime object

Francesco Lamonica 805206 at bugs.launchpad.net
Sun Jul 3 19:00:49 UTC 2011


Public bug reported:

there is a bug in ubuntu 10.04 (both 32 and 64 bits) php5-common
package.

the following code shows the problem:

<?php
$nstartDate = new DateTime();
$nendDate = new DateTime();
print("<br/>0:" . $nstartDate->format("Y-m-d")); //this prints 3 months ago

$nstartDate->sub(new DateInterval("P1M"));

print("<br/>1:" . $nstartDate->format("Y-m-d")); //this prints 3 months
ago

$nstartDate->getTimestamp();
print("<br/>2:" . $nstartDate->format("Y-m-d")); //this prints 3 months ago

$nstartDate->getTimestamp();
print("<br/>3:" . $nstartDate->format("Y-m-d")); //this prints 3 months ago

?>

as you will see, each time getTimestamp() is called the date is
subtracted by one month (instead of just once) no other distro seems to
be affectd nor php 5.3.3.

Please update it as soon as possible. This is a serious bug in php code.

** Affects: php5 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: datetime php

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in Ubuntu.
https://bugs.launchpad.net/bugs/805206

Title:
  php 5.3.2 is affected by a bug in the DateTime object

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/805206/+subscriptions



More information about the Ubuntu-server-bugs mailing list