Edit report at https://bugs.php.net/bug.php?id=65548&edit=1
ID: 65548 Comment by: cmbecker69 at gmx dot de Reported by: mail at roland-ramthun dot de Summary: Comparison for DateTimeImmutable doesn't work Status: Open Type: Bug Package: Date/time related Operating System: Linux PHP Version: 5.5.3 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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