Doc #54139 [NEW]: All date acceptance functions should cross-reference checkdate()
| From: | ryan_a_martin at yahoo dot com | Date: | Wed, 02 Mar 2011 14:54:59 +0000 |
| Subject: | Doc #54139 [NEW]: All date acceptance functions should cross-reference checkdate() | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6042@lists.php.net to get a copy of this message | ||
From:
Operating system: N/A
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:All date acceptance functions should cross-reference checkdate()
Description:
------------
Since PHP functions like strtotime, mktime, and date_parse do not catch
well-formatted but invalid dates like 2009-02-30 and 2010-11-31, it is
necessary to use checkdate() to catch them. All documentation pages that
document functions intended for accepting Gregorian dates should list
checkdate() in their "See Also" sections.
Test script:
---------------
print_r(date_parse('2009-02-30'));
print_r(strtotime('2010-11-31'));
Expected result:
----------------
For date_parse, error_count > 0 and an error thrown. For strtotime, an
error thrown, not a UNIX timestamp. Since this does not happen, we need the
documentation to make clear that these functions do not validate Gregorian
dates, and that a call to checkdate() is required to catch such dates.
Actual result:
--------------
Array ( [year] => 2009 [month] => 2 [day] => 30 [hour] => [minute] =>
[second] => [fraction] => [warning_count] => 0 [warnings] => Array ( )
[error_count] => 0 [errors] => Array ( ) [is_localtime] => ) 1291179600
--
Edit bug report at http://bugs.php.net/bug.php?id=54139&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54139&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54139&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54139&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54139&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54139&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54139&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54139&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54139&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54139&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54139&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54139&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54139&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54139&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54139&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54139&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54139&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54139&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54139&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54139&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54139&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54139&r=mysqlcfg