Bug #68062 [Opn->Csd]: DateTimeZone::getOffset() should accept DateTimeInterface

From: Date: Thu, 09 Oct 2014 07:48:13 +0000
Subject: Bug #68062 [Opn->Csd]: DateTimeZone::getOffset() should accept DateTimeInterface
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187971@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68062&edit=1

 ID:                 68062
 Updated by:         fmargaine@php.net
 Reported by:        evert at rooftopsolutions dot nl
 Summary:            DateTimeZone::getOffset() should accept
                     DateTimeInterface
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Date/time related
 PHP Version:        5.5.17
-Assigned To:        
+Assigned To:        fmargaine
 Block user comment: N
 Private report:     N

 New Comment:

Fixed in PHP-5.6: https://github.com/php/php-src/commit/046c345de508dff769cfcf4a448a4a5a4f009294

In master: https://github.com/php/php-src/commit/9680829389aefc5bee2f0cdeacd34cbef6b66bbd


Previous Comments:
------------------------------------------------------------------------
[2014-09-20 02:15:39] evert at rooftopsolutions dot nl

Description:
------------
The following signature

DateTimeZone::getOffset(DateTime $dateTime);

Should be:

DateTimeZone::getOffset(DateTimeInterface $dateTime);

Test script:
---------------
$tz = new DateTimeZone('Europe/London');
$dt = new DateTimeImmutable('2014-09-20', $tz);

echo $tz->getOffset($dt);

Expected result:
----------------
3600

Actual result:
--------------
PHP Warning:  DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in
/Users/evert/code/foo.php on line 6



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



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


Thread (2 messages)

« previous php.bugs (#187971) next »