ID: 48232
Updated by: [email protected]
Reported By: vqkq7ov02 at sneakemail dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Linux
PHP Version: 5.2.9
New Comment:
See bug #46932 (strtotime() is same thing :)
Previous Comments:
------------------------------------------------------------------------
[2009-05-11 07:28:34] vqkq7ov02 at sneakemail dot com
Description:
------------
When date_modify() is given the last day of a month and asked to add
one weekday (e.g. +1 Sunday), if the last day of the month is that same
weekday, then date_modify() doesn't add a week-- it returns the same
date it was given.
This problem occurs in PHP 5.2.9. It doesn't occur in PHP 5.2.6, which
returns the correct result.
Reproduce code:
---------------
<?php
echo "PHP Version = ", phpversion(), "\n";
$dt = new DateTime();
date_date_set($dt, 2009, 5, 31);
echo 'Before date_modify: ', $dt->format('l m/j/y'), "\n";
$action = "+1 Sunday";
date_modify($dt, $action);
echo "After date_modify ($action): ", $dt->format('l m/j/y') , "\n",
"Should be Sunday 6/7/09\n";
?>
Expected result:
----------------
PHP Version = 5.2.6-3ubuntu4.1
Before date_modify: Sunday 05/31/09
After date_modify (+1 Sunday): Sunday 06/7/09
Should be Sunday 6/7/09
Actual result:
--------------
PHP Version = 5.2.9-2
Before date_modify: Sunday 05/31/09
After date_modify (+1 Sunday): Sunday 05/31/09
Should be Sunday 6/7/09
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48232&edit=1