| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             
             [2013-10-29 15:47 UTC] inefedor at gmail dot com
  [2013-11-03 11:53 UTC] felipe@php.net
 
-Status:      Open
+Status:      Assigned
-Assigned To:
+Assigned To: derick
  [2013-11-29 22:33 UTC] nikic@php.net
  [2013-11-29 22:33 UTC] nikic@php.net
 
-Status: Assigned
+Status: Closed
  [2013-12-01 11:32 UTC] ab@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 06:00:01 2025 UTC | 
Description: ------------ Errors are generated when attempting to: Diff a datetimeimmutable and a datetime Diff a datetime and a datetimeimmutable Diff a datetimeimmutable and another datetimeimmutable The documentation implies that this should work correctly, and that diff() accepts DateTimeInterface Test script: --------------- $di1 = new DateTimeImmutable('now'); $di2 = new DateTimeImmutable('+1 hour'); $d = new DateTime('-1 hour'); $di1->diff($d); // DateInterval +1H $di1->diff($di2); // DateInterval -1H $d->diff($di1); // DateInterval +1H Expected result: ---------------- DateInterval objects in all three cases Actual result: -------------- Produced via `php -a` $di1->diff($d); // PHP Fatal error: DateTime::diff() must be derived from DateTimeImmutable::diff in Unknown on line 0 $di1->diff($di2); // DateInterval -1H // PHP Fatal error: DateTime::diff() must be derived from DateTimeImmutable::diff in Unknown on line 0 $d->diff($di1); // DateInterval +1H // PHP Warning: DateTime::diff() expects parameter 1 to be DateTime, object given in php shell code on line 1 // bool(false)