|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #27097 checkdate asks for long doc says int
Submitted: 2004-01-30 08:00 UTC Modified: 2004-04-15 12:48 UTC
Avg. Score:1.3 ± 0.9
Reproduced:5 of 9 (55.6%)
Same Version:-1 (-20.0%)
Same OS:-2 (-40.0%)
From: trancer at trancer dot nl Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: 4.3.4 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: trancer at trancer dot nl
New email:
PHP Version: OS:


 [2004-01-30 08:00 UTC] trancer at trancer dot nl
Had the following warning:

Warning: checkdate() expects parameter 1 to be long, string given in

Documentation says:

bool checkdate ( int month, int day, int year)

int should be long here or long should be int, either of them.

Might have to do with bug #25530, but still, the error issues a long while the demanded type is int. 

Reproduce code:
<?php checkdate("", "", ""); ?>

Expected result:
Warning: checkdate() expects parameter 1 to be int, string given in

Actual result:
Warning: checkdate() expects parameter 1 to be long, string given in


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-30 10:15 UTC]
The documentation is right.
You are giving a string, while it expects an integer.

You should learn more about variable types in PHP.
 [2004-01-30 10:47 UTC]
Nuno: And you need to learn to read ;-) He mentions that INT (from the manual) is not the same as the LONG (from the error message).
 [2004-01-30 10:48 UTC]
should the proto be number ?
 [2004-01-30 11:03 UTC]
Note that "int" in php is a "signed long int"(32 bit), so int and long are equivalent. But i think you shouldn't have to know C to read error messages, so IMO the error message should change. I'll send a patch for that to the list.

Additionally, checkdate() doesn't convert to int like other php functions do, but since it's a validating function, that strictness is desirable behaviour imo, but should be documented. I'll add a note to the manual.
 [2004-01-30 11:13 UTC]
No, the error message is correct. We use a long, internal type is long, parse_parameters uses the "l" as type specifier... the docs needs fixing.
 [2004-01-30 11:13 UTC]
When i think more about it, it doesn't really make sense for checkdate to accept "1e1" (which is "numeric" but not an integer) but not "1d1", so it is either too strict or not strict enough. Any thoughts?
 [2004-01-30 11:14 UTC]
Derick: Then why does zend_zval_type_name return "integer"?
 [2004-02-02 11:04 UTC]
What should we do then?

Maybe its better to add a note to explaining that long is similar to an integer.

 [2004-04-15 12:48 UTC]
Since we didn't arrive to any conclusion, I'm closing this bug.
 [2012-12-07 16:22 UTC] chrisdavies at hotmail dot com
I'm checking for the format of a date using :
if  (checkdate ($month,$year,$day))   

 if the format is ok, then it's fine, if the format is wrong, checkdate dies with nasty errors, anyway around this please?

Warning: checkdate() expects parameter 3 to be long, string given in C:\Inetpub\wwwroot\dateSearch.php on line 40

should I not be using checkdate() for validation purposes?  if not, wtf is the point of checkdate()?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 08:01:27 2024 UTC