Bug #62476 [NEW]: DateTime::createFromFormat z format incorrect wrt 29.02

From: Date: Wed, 04 Jul 2012 00:20:58 +0000
Subject: Bug #62476 [NEW]: DateTime::createFromFormat z format incorrect wrt 29.02
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-171727@lists.php.net to get a copy of this message
From:             kaido at tradenet dot ee
Operating system: debian 2.6.32-5-amd64
PHP version:      5.4.4
Package:          Calendar related
Bug Type:         Bug
Bug description:DateTime::createFromFormat z format incorrect wrt 29.02

Description:
------------
When creating DateTime object from string and using z (day of year) format
option, 
the 29.02 of the leap year is missing. works ok in 5.3.5

Test script:
---------------
for ($d=55;$d<65;$d++) {
        $dt = DateTime::createFromFormat ('z.Y', $d.'.2012');
        $dd = $dt->format ('d.m.Y');
        echo "$d $dd\n";
}

29.02.2012 is clearly missing .. 

Expected result:
----------------
55 25.02.2012
56 26.02.2012
57 27.02.2012
58 28.02.2012
59 29.02.2012
60 01.03.2012
61 02.03.2012
62 03.03.2012
63 04.03.2012
64 05.03.2012

Actual result:
--------------
55 25.02.2012
56 26.02.2012
57 27.02.2012
58 28.02.2012
59 01.03.2012
60 02.03.2012
61 03.03.2012
62 04.03.2012
63 05.03.2012
64 06.03.2012

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



Thread (5 messages)

« previous php.bugs (#171727) next »