#48906 [NEW]: checkdate returns true on false date
| From: | arno dot zandink at gmail dot com | Date: | Mon, 13 Jul 2009 19:11:20 +0000 |
| Subject: | #48906 [NEW]: checkdate returns true on false date | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-139697@lists.php.net to get a copy of this message | ||
From: arno dot zandink at gmail dot com
Operating system: Windows / Linux
PHP version: 5.3.0
PHP Bug Type: Date/time related
Bug description: checkdate returns true on false date
Description:
------------
checkdate returns true when the date given is not a valid date
If this is not considered a bug, perhaps adding a waring on the manual
page would be wise
Reproduce code:
---------------
---
From manual page: function.checkdate
---
<?php
$date = "01-01-1980 <script>alert('test');</script>";
$aDate_parts = preg_split("/[\s-]+/", $date);
var_dump(
checkdate(
$aDate_parts[1], // Month
$aDate_parts[0], // Day
$aDate_parts[2] // Year
)
);
?>
Expected result:
----------------
I would expect var_dump to print a boolean (false) because the date is not
valid
Actual result:
--------------
A boolean (true) is returned with a invalid date
--
Edit bug report at http://bugs.php.net/?id=48906&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48906&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48906&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48906&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48906&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48906&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48906&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48906&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48906&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48906&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48906&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48906&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48906&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48906&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48906&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48906&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48906&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48906&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48906&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48906&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48906&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48906&r=mysqlcfg