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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

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-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 01:03:53 2023 UTC