php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68062 DateTimeZone::getOffset() should accept DateTimeInterface
Submitted: 2014-09-20 02:15 UTC Modified: 2014-10-09 07:48 UTC
From: evert at rooftopsolutions dot nl Assigned: fmargaine (profile)
Status: Closed Package: Date/time related
PHP Version: 5.5.17 OS:
Private report: No CVE-ID: None
 [2014-09-20 02:15 UTC] 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


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-09 07:48 UTC] fmargaine@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: fmargaine
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 14:01:30 2024 UTC