From:
Operating system: Win 7
PHP version: 5.3.5
Package: Date/time related
Bug Type: Bug
Bug description:DateTime::createFromFormat() fails to parse cookie expiration
date
Description:
------------
The class DateTime is supposed to handle date strings like used for cookie
expiration dates. It explicitly defines the format DateTime::COOKIE but
fails to parse it.
Test script:
---------------
<?php
$date = DateTime::createFromFormat(DateTime::COOKIE, "Mon, 21-Jan-2041
15:24:52 GMT");
print_r($date);
?>
Same goes for
<?php
$date = date_parse_from_format(DateTime::COOKIE, "Mon, 21-Jan-2041 15:24:52
GMT");
print_r($date);
?>
Expected result:
----------------
Something with a date instead of NULL O.o
Actual result:
--------------
Array
(
[year] => 2020
[month] => 1
[day] => 21
[hour] => 41
[minute] => 15
[second] => 24
[fraction] =>
[warning_count] => 1
[warnings] => Array
(
[25] => The parsed time was invalid
)
[error_count] => 4
[errors] => Array
(
[16] => Unexpected data found.
[22] => The timezone could not be found in the database
[25] => Trailing data
)
[is_localtime] => 1
[zone_type] => 0
)
--
Edit bug report at http://bugs.php.net/bug.php?id=53879&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53879&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53879&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53879&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53879&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53879&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53879&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53879&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53879&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53879&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53879&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53879&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53879&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53879&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53879&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53879&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53879&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53879&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53879&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53879&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53879&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53879&r=mysqlcfg