Bug #71700 [NEW]: Extra day on diff between begin and end of march 2016

From: Date: Wed, 02 Mar 2016 08:48:54 +0000
Subject: Bug #71700 [NEW]: Extra day on diff between begin and end of march 2016
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199559@lists.php.net to get a copy of this message
From:             soullivaneuh at gmail dot com
Operating system: Ubuntu 15.10
PHP version:      5.6.18
Package:          Date/time related
Bug Type:         Bug
Bug description:Extra day on diff between begin and end of march 2016

Description:
------------
When you try an absolute diff between '2016-03-31' and '2016-03-01',
you'll have an extra day field.

Test script:
---------------
$date1 = new \DateTime('2016-03-01');
$date2 = new \DateTime('2016-03-31');

$diff = date_diff($date1, $date2, true);

var_dump($diff);


Expected result:
----------------
class DateInterval#2 (15) {
  public $y =>
  int(0)
  public $m =>
  int(1)
  public $d =>
  int(0)
  public $h =>
  int(0)
  public $i =>
  int(0)
  public $s =>
  int(0)
  public $weekday =>
  int(0)
  public $weekday_behavior =>
  int(0)
  public $first_last_day_of =>
  int(0)
  public $invert =>
  int(0)
  public $days =>
  int(30)
  public $special_type =>
  int(0)
  public $special_amount =>
  int(0)
  public $have_weekday_relative =>
  int(0)
  public $have_special_relative =>
  int(0)
}


Actual result:
--------------
class DateInterval#2 (15) {
  public $y =>
  int(0)
  public $m =>
  int(1)
  public $d =>
  int(1)
  public $h =>
  int(0)
  public $i =>
  int(0)
  public $s =>
  int(0)
  public $weekday =>
  int(0)
  public $weekday_behavior =>
  int(0)
  public $first_last_day_of =>
  int(0)
  public $invert =>
  int(0)
  public $days =>
  int(30)
  public $special_type =>
  int(0)
  public $special_amount =>
  int(0)
  public $have_weekday_relative =>
  int(0)
  public $have_special_relative =>
  int(0)
}


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



Thread (2 messages)

« previous php.bugs (#199559) next »