Req #71520 [NEW]: Adding the DateTime constants to the DateTimeInterface interface
| From: | nyamsprod at gmail dot com | Date: | Thu, 04 Feb 2016 09:25:59 +0000 |
| Subject: | Req #71520 [NEW]: Adding the DateTime constants to the DateTimeInterface interface | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199048@lists.php.net to get a copy of this message | ||
From: nyamsprod at gmail dot com
Operating system: Irrelevant
PHP version: Irrelevant
Package: Date/time related
Bug Type: Feature/Change Request
Bug description:Adding the DateTime constants to the DateTimeInterface interface
Description:
------------
Currently it's not possible to access DateTime constants directly from
DateTimeImmutable.
Test script:
---------------
$datetime = new DateTimeImmutable('2000-01-01 00:00:00', new
DateTimeZone('Africa/Kinshasa'));
var_dump($datetime->format(DateTimeImmutable::ATOM));
var_dump($datetime->format(DateTimeImmutable::COOKIE));
var_dump($datetime->format(DateTimeImmutable::ISO8601));
var_dump($datetime->format(DateTimeImmutable::RFC822));
var_dump($datetime->format(DateTimeImmutable::RFC850));
var_dump($datetime->format(DateTimeImmutable::RFC1036));
var_dump($datetime->format(DateTimeImmutable::RFC2822));
var_dump($datetime->format(DateTimeImmutable::RFC3339));
var_dump($datetime->format(DateTimeImmutable::RSS));
var_dump($datetime->format(DateTimeImmutable::W3C));
Expected result:
----------------
string(25) "2000-01-01T00:00:00+01:00"
string(34) "Saturday, 01-Jan-2000 00:00:00 WAT"
string(24) "2000-01-01T00:00:00+0100"
string(29) "Sat, 01 Jan 00 00:00:00 +0100"
string(32) "Saturday, 01-Jan-00 00:00:00 WAT"
string(29) "Sat, 01 Jan 00 00:00:00 +0100"
string(31) "Sat, 01 Jan 2000 00:00:00 +0100"
string(25) "2000-01-01T00:00:00+01:00"
string(31) "Sat, 01 Jan 2000 00:00:00 +0100"
string(25) "2000-01-01T00:00:00+01:00"
Actual result:
--------------
The following constant are missing on the DateTimeInterface interface
DateTimeInterface::ATOM,
DateTimeInterface::COOKIE,
DateTimeInterface::ISO8601,
DateTimeInterface::RFC822,
DateTimeInterface::RFC850,
DateTimeInterface::RFC1036,
DateTimeInterface::RFC2822,
DateTimeInterface::RFC3339,
DateTimeInterface::RSS,
DateTimeInterface::W3C
--
Edit bug report at https://bugs.php.net/bug.php?id=71520&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71520&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71520&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71520&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71520&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71520&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71520&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71520&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71520&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71520&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71520&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71520&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71520&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71520&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71520&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71520&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71520&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71520&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71520&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71520&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71520&r=mysqlcfg