|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-11 08:51 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 06:00:01 2025 UTC |
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