#25530 [Opn->Csd]: Function checkdate() accepts float values as valid parameters
| From: | iliaa@php.net | Date: | Mon, 15 Sep 2003 00:06:27 +0000 |
| Subject: | #25530 [Opn->Csd]: Function checkdate() accepts float values as valid parameters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47568@lists.php.net to get a copy of this message | ||
ID: 25530
Updated by: iliaa@php.net
Reported By: jlamberg at cc dot helsinki dot fi
-Status: Open
+Status: Closed
Bug Type: Date/time related
Operating System: WinXP Pro
PHP Version: 4CVS-2003-09-14 (stable)
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-09-14 05:32:27] jlamberg at cc dot helsinki dot fi
Description:
------------
Function checkdate(mon, day, year) accepts float values as valid
parameters.
Reproduce code:
---------------
$day1 = 13.7;
$mon1 = 5.1;
$year1 = 2000.75;
if (checkdate($mon1, $day1, $year1))
echo "Valid date";
else
echo "Invalid date";
$day2 = "4e4";
$mon2 = 5.1;
$year2 = "2000.75";
if (checkdate($mon2, $day2, $year2))
echo "Valid date";
else
echo "Invalid date";
Expected result:
----------------
I expected the script to echo two times 'Invalid date' since only
integer parameters should be accepted.
Actual result:
--------------
The script echoed two times 'Valid date'. The first date is a clear
case. I guess the second date is considered valid because of the string
"4e4" being taken as "4" (the number 4), which is also wrong.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25530&edit=1