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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC