Bug #70810 [Opn]: DateInterval equals every other DateInterval
Edit report at https://bugs.php.net/bug.php?id=70810&edit=1
ID: 70810
User updated by: f dot bosch at genkgo dot nl
Reported by: f dot bosch at genkgo dot nl
Summary: DateInterval equals every other DateInterval
Status: Open
Type: Bug
Package: Date/time related
Operating System: linux
PHP Version: 5.6.14
Block user comment: N
Private report: N
New Comment:
Actual and expected result are switched (sorry for that).
Previous Comments:
------------------------------------------------------------------------
[2015-10-29 09:50:59] f dot bosch at genkgo dot nl
Description:
------------
DateInterval always equals another DateInterval object while their inner values are different. This
is not expected behaviour. Looks like this is the case for all PHP versions: https://3v4l.org/bQnf0. If you ask me, this bug is different then
#70381 (Support comparing DateInterval objects).
Test script:
---------------
<?php
var_dump(new DateInterval('PT1H') == new DateInterval('P1D'));
var_dump(new DateInterval('PT1H') === new DateInterval('P1D'));
var_dump(new DateInterval('PT1H') , new DateInterval('P1D'));
Expected result:
----------------
bool(true)
bool(false)
object(DateInterval)#3 (0) { }
object(DateInterval)#4 (0) { }
Actual result:
--------------
bool(false)
bool(false)
object(DateInterval)#3 (0) { }
object(DateInterval)#4 (0) { }
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70810&edit=1
Thread (6 messages)