From: kgrecki at gmail dot com
Operating system: Linux
PHP version: 5.3.0
PHP Bug Type: Date/time related
Bug description: DateTime::modify('last day') returns last day of the month
Description:
------------
call to modify('last day') has different effect in PHP 5.3 than in 5.2
It used to return a previous day, now it seems to return last day of the
month,
according to
http://www.gnu.org/software/automake/manual/tar/General-date-syntax.html#SEC115
"last" means -1 so 5.2 seems to get it right
Reproduce code:
---------------
date_default_timezone_set('Europe/London');
$dt = new DateTime('today');
var_dump($dt->format('c'));
$dt->modify('last day');
var_dump($dt->format('c'));
$dt = new DateTime('01-04-2009');
var_dump($dt->format('c'));
$dt->modify('last day');
var_dump($dt->format('c'));
Expected result:
----------------
PHP 5.2.11 (cli) (built: Sep 18 2009 10:59:00)
string(25) "2009-10-16T00:00:00+01:00"
string(25) "2009-10-15T00:00:00+01:00"
string(25) "2009-04-01T00:00:00+01:00"
string(25) "2009-03-31T00:00:00+01:00"
Actual result:
--------------
PHP 5.3.0 (cli) (built: Jul 21 2009 17:02:21)
string(25) "2009-10-16T00:00:00+01:00"
string(25) "2009-10-31T00:00:00+00:00"
string(25) "2009-04-01T00:00:00+01:00"
string(25) "2009-04-30T00:00:00+01:00"
--
Edit bug report at http://bugs.php.net/?id=49904&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49904&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49904&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49904&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49904&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49904&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49904&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49904&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49904&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49904&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49904&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49904&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49904&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49904&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49904&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49904&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49904&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49904&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49904&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49904&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49904&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49904&r=mysqlcfg