ID:               48906
 Comment by:       sjoerd-php at linuxonly dot nl
 Reported By:      arno dot zandink at gmail dot com
 Status:           Open
 Bug Type:         Date/time related
 Operating System: *
 PHP Version:      5.3.0
 New Comment:

Thank you for your bug report.

Your example code can be summarized as follows:
<?php var_dump(checkdate('01', '01', '1980')); ?>

I would expect this to return true, because January 1st 1980 is a valid
date. Why do you think it is an invalid date?


Previous Comments:
------------------------------------------------------------------------

[2009-07-13 19:11:20] arno dot zandink at gmail dot com

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 this bug report at http://bugs.php.net/?id=48906&edit=1

Reply via email to