Bug->Req #69661 [Nab->ReO]: date_parse says the day is 1 instead of false

From: Date: Wed, 14 Feb 2018 22:08:36 +0000
Subject: Bug->Req #69661 [Nab->ReO]: date_parse says the day is 1 instead of false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213965@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: Not a bug +Status: Re-Opened -Type: Bug +Type: Feature/Change Request Package: Date/time related Operating System: Ubuntu PHP Version: 5.6.9 -Assigned To: cmb +Assigned To: Block user comment: N Private report: N New Comment: Okay, changing to feature request. Previous Comments: ------------------------------------------------------------------------ [2018-02-14 18:48:41] php-bugs at xpaw dot me Documented behaviour does not make it correct behaviour. Currently I have no way of testing if the day field is default or was actually parsed from the input. ------------------------------------------------------------------------ [2018-02-14 18:27:38] cmb@php.net Indeed, this is documented behavior! ------------------------------------------------------------------------ [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

« previous php.bugs (#213965) next »