|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jlamberg at cc dot helsinki dot fi
New email:
PHP Version: OS:


 [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-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 22 05:03:37 2021 UTC