Bug #64653 [Ver->Csd]: Subtraction of DateInterval yields wrong result.
Edit report at https://bugs.php.net/bug.php?id=64653&edit=1
ID: 64653
Updated by: derick@php.net
Reported by: eugen dot artus at gmx dot net
Summary: Subtraction of DateInterval yields wrong result.
-Status: Verified
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Kubuntu 12.04
PHP Version: 5.4.14
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
This got fixed in PHP 7.2.0.
Previous Comments:
------------------------------------------------------------------------
[2016-06-14 10:53:25] cmb@php.net
Verified: <https://3v4l.org/LpEF6>
------------------------------------------------------------------------
[2013-04-16 21:47:25] eugen dot artus at gmx dot net
Description:
------------
The test script below prints '2370-01-00' as the result, which is obviously wrong.
Test script:
---------------
<?php
$date = new \DateTime('2370-01-31');
echo $date->sub(new \DateInterval('P1M'))->format('Y-m-d');
?>
Expected result:
----------------
2369-12-31
Actual result:
--------------
2370-01-00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64653&edit=1
Thread (3 messages)