|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25530 Function checkdate() accepts float values as valid parameters
Submitted: 2003-09-14 05:32 UTC Modified: 2003-09-14 20:06 UTC
From: jlamberg at cc dot helsinki dot fi Assigned:
Status: Closed Package: Date/time related
PHP Version: 4CVS-2003-09-14 (stable) OS: WinXP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
49 - 24 = ?
Subscribe to this entry?

 [2003-09-14 05:32 UTC] jlamberg at cc dot helsinki dot fi
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";
  echo "Invalid date";

$day2 = "4e4";
$mon2 = 5.1;
$year2 = "2000.75";

if (checkdate($mon2, $day2, $year2))
  echo "Valid date";
  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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-14 20:06 UTC]
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
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Jun 04 16:01:43 2020 UTC