Bug #69205 [Asn]: DateTime for December 31st fails once every 400 years

From: Date: Sat, 11 May 2019 11:10:00 +0000
Subject: Bug #69205 [Asn]: DateTime for December 31st fails once every 400 years
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220815@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69205&edit=1

 ID:                 69205
 Updated by:         cmb@php.net
 Reported by:        nd dot wortel at gmail dot com
 Summary:            DateTime for December 31st fails once every 400
                     years
 Status:             Assigned
 Type:               Bug
 Package:            Date/time related
 Operating System:   Ubuntu 14.04
 PHP Version:        5.5.22
 Assigned To:        derick
 Block user comment: N
 Private report:     N

 New Comment:

Indeed, still good for all actively supported versions[1].

<https://www.php.net/supported-versions.php>


Previous Comments:
------------------------------------------------------------------------
[2018-09-30 14:04:48] cmb@php.net

Related To: Bug #67993

------------------------------------------------------------------------
[2018-09-30 14:04:12] cmb@php.net

Confirmed: <https://3v4l.org/bDjLn>.  Obviously fixed in
PHP 7.2+.

------------------------------------------------------------------------
[2015-10-28 10:04:48] nd dot wortel at gmail dot com

The following test shows that this is a problem in PHP 5.4, 5.5, 5.6 and 7. PHP 5.3 does not seem to
be affected: https://travis-ci.org/nicwortel/nicwortel/php-date-bug

------------------------------------------------------------------------
[2015-06-15 11:35:14] riggsfolly at gmail dot com

This also appears to be a problem in all releases 

Errored in 5.3/5.4/5.5/5.6

------------------------------------------------------------------------
[2015-06-15 11:31:14] riggsfolly at gmail dot com

This also appears to be demonstrating the same or similiar problem

<?php

$test = date_create("-1000-12-27");
echo date_format($test, 'Y-m-d H:i:s').PHP_EOL;
date_modify($test, '+1 day');
echo date_format($test, 'Y-m-d H:i:s').PHP_EOL.PHP_EOL;


$test = date_create("-2000-12-27");
echo date_format($test, 'Y-m-d H:i:s').PHP_EOL;
date_modify($test, '+1 day');
echo date_format($test, 'Y-m-d H:i:s').PHP_EOL.PHP_EOL;


$test = date_create("-3000-12-27");
echo date_format($test, 'Y-m-d H:i:s').PHP_EOL;
date_modify($test, '+1 day');
echo date_format($test, 'Y-m-d H:i:s').PHP_EOL.PHP_EOL;

RESULTS:
-1000-12-28 00:00:00
-1000-12-30 00:00:00

-2000-12-27 00:00:00
-2000-12-28 00:00:00

-3000-12-28 00:00:00
-3000-12-30 00:00:00

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=69205


--
Edit this bug report at https://bugs.php.net/bug.php?id=69205&edit=1


Thread (11 messages)

« previous php.bugs (#220815) next »