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

 ID:                 65548
 Updated by:         ni...@php.net
 Reported by:        mail at roland-ramthun dot de
 Summary:            Comparison for DateTimeImmutable doesn't work
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Date/time related
 Operating System:   Linux
 PHP Version:        5.5.3
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of bsitnikov...@sugarcrm.com
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=d7f5f1ef35c32d6943cd76a3c51752e8d64c5e5e
Log: Fix bug #65548: Comparison for DateTimeImmutable doesn't work


Previous Comments:
------------------------------------------------------------------------
[2013-08-27 23:44:59] cmbecker69 at gmx dot de

It seems that the comparison operators are not overloaded for
DateTimeImmutable objects.  Apparently they show the same behavior
as for arbitrary user defined classes.

If my assumption is correct, instead of adding a special treatment 
for the comparison operators wrt. DateTimeImmutable objects, it
might be considered to add a magic method __compare(). However,
I'm not sure, if this fits well with type juggling.

------------------------------------------------------------------------
[2013-08-25 14:03:21] mail at roland-ramthun dot de

Description:
------------
Comparison for DateTimeImmutable doesn't work. The same example with DateTime 
objects works.

Test script:
---------------
$a = new DateTimeImmutable('today');
$b = new DateTimeImmutable('tomorrow');

if ($a < $b) {
   print("yay");
}


Expected result:
----------------
yay

Actual result:
--------------
no output


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



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

Reply via email to