ID: 40691 Updated by: [EMAIL PROTECTED] Reported By: hans at velum dot net -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Gentoo Linux PHP Version: 5.2.1 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Read on object comparison in PHP, what you are attempting will not work. if you want to compare 2 dates, convert them to unix timestamps first. Previous Comments: ------------------------------------------------------------------------ [2007-03-02 15:43:14] hans at velum dot net Description: ------------ The equality check (==) for DateTime objects does not actually check the properties of the object (i.e. the internally stored date). This is very counter-intuitive as it does not follow the behavior of user-created objects or even other internal PHP objects like Exception. Reproduce code: --------------- $d1 = new DateTime("2001-01-01"); $d2 = new DateTime("2007-02-28"); print "DateTime Equal? " . var_export($d1 == $d2, true) . "\n"; Expected result: ---------------- DateTime Equal? false Actual result: -------------- DateTime Equal? true ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40691&edit=1
