Bug #68062 [NEW]: DateTimeZone::getOffset() should accept DateTimeInterface
| From: | evert at rooftopsolutions dot nl | Date: | Sat, 20 Sep 2014 02:15:39 +0000 |
| Subject: | Bug #68062 [NEW]: DateTimeZone::getOffset() should accept DateTimeInterface | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187618@lists.php.net to get a copy of this message | ||
From: evert at rooftopsolutions dot nl
Operating system:
PHP version: 5.5.17
Package: Date/time related
Bug Type: Bug
Bug description:DateTimeZone::getOffset() should accept DateTimeInterface
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
--
Edit bug report at https://bugs.php.net/bug.php?id=68062&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68062&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68062&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68062&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68062&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68062&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68062&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68062&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68062&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68062&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68062&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68062&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68062&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68062&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68062&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68062&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68062&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68062&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68062&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68062&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68062&r=mysqlcfg