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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: evert at rooftopsolutions dot nl
New email:
PHP Version: OS:

 

 [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: Sun Dec 22 04:01:29 2024 UTC