Bug #81273 [NEW]: Date interval calculation not correct

From: Date: Mon, 19 Jul 2021 07:23:56 +0000
Subject: Bug #81273 [NEW]: Date interval calculation not correct
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235155@lists.php.net to get a copy of this message
From:             alex dot a dot pott at gmail dot com
Operating system: OS X
PHP version:      8.1Git-2021-07-19 (Git)
Package:          Date/time related
Bug Type:         Bug
Bug description:Date interval calculation not correct

Description:
------------
Date interval calculation is has changed in 8.1 and the new calculation
is incorrect.

8.0: https://3v4l.org/8g4NB#v8.0.8
8.1: https://3v4l.org/8g4NB/rfc#vgit.master

This seems similar to https://bugs.php.net/bug.php?id=80998

Test script:
---------------
<?php

$time = '2000-01-01 00:00:00.000000';
$tz_aus = new DateTimeZone('Australia/Sydney');
$tz_us = new DateTimeZone('America/Los_Angeles');
$auz = new DateTime($time, $tz_aus);
$us = new DateTime($time, $tz_us);

$diff = $auz->diff($us);
// Should output int(19)
var_dump($diff->h);

Expected result:
----------------
It should output:
int(19)

Actual result:
--------------
int(0)

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


Thread (6 messages)

« previous php.bugs (#235155) next »