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

From: Date: Tue, 19 May 2015 11:17:01 +0000
Subject: Bug #69661 [NEW]: date_parse says the day is 1 instead of false
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192754@lists.php.net to get a copy of this message
From:             php-bugs at xpaw dot me
Operating system: Ubuntu
PHP version:      5.6.9
Package:          Date/time related
Bug Type:         Bug
Bug description:date_parse says the day is 1 instead of false

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 bug report at https://bugs.php.net/bug.php?id=69661&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69661&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69661&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69661&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69661&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69661&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69661&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69661&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69661&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69661&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69661&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69661&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69661&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69661&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69661&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69661&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69661&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69661&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69661&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69661&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69661&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#192754) next »