Bug #69661 [Ver->Nab]: date_parse says the day is 1 instead of false
| From: | cmb@php.net | Date: | Wed, 14 Feb 2018 18:27:39 +0000 |
| Subject: | Bug #69661 [Ver->Nab]: date_parse says the day is 1 instead of false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213958@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69661&edit=1
ID: 69661
Updated by: cmb@php.net
Reported by: php-bugs at xpaw dot me
Summary: date_parse says the day is 1 instead of false
-Status: Verified
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Ubuntu
PHP Version: 5.6.9
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Indeed, this is documented behavior!
Previous Comments:
------------------------------------------------------------------------
[2017-01-04 17:04:24] contact at frank-liepert dot de
This is expected behaviour, see "Textual month and four digit year (Day reset to 1)" on http://php.net/manual/de/datetime.formats.date.php
------------------------------------------------------------------------
[2015-05-19 11:54:25] cmb@php.net
See also <http://3v4l.org/eAiXb>.
------------------------------------------------------------------------
[2015-05-19 11:17:01] php-bugs at xpaw dot me
Description:
------------
I don't know if this is expected behaviour or not, but parsing a date without a day, will
produce a result where 'day' will be set to 1. If this is expected, there really should be
a parameter that disables this. I'm using this for user provided data, and it's not really
valid.
Test script:
---------------
var_dump(date_parse("May 2013"));
Expected result:
----------------
["day"]=>
bool(false)
Actual result:
--------------
["day"]=>
int(1)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69661&edit=1