|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
38 + 23 = ?
Subscribe to this entry?

 [2014-09-20 02:15 UTC] evert at rooftopsolutions dot nl
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:

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


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


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