Bug #69661 [Com]: date_parse says the day is 1 instead of false

From: Date: Wed, 04 Jan 2017 17:04:25 +0000
Subject: Bug #69661 [Com]: date_parse says the day is 1 instead of false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206301@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 Comment by: contact at frank-liepert dot de Reported by: php-bugs at xpaw dot me Summary: date_parse says the day is 1 instead of false Status: Verified Type: Bug Package: Date/time related Operating System: Ubuntu PHP Version: 5.6.9 Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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 (#206301) next »