php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63257 checkdate(): Wrong if year is two digits and year is 2000
Submitted: 2012-10-10 22:17 UTC Modified: 2013-10-01 15:29 UTC
From: php at skay dot se Assigned:
Status: Not a bug Package: *Calendar problems
PHP Version: 5.3.10 OS: Unix
Private report: No CVE-ID: None
 [2012-10-10 22:17 UTC] php at skay dot se
Description:
------------
---
From manual page: http://www.php.net/function.checkdate
---

PHP version 5.3.10


If year is 2000 the function will return TRUE (provided the rest is valid) - Thats good!
But if year is 00 the function will always return FALSE


Test script:
---------------
echo checkdate("01", "01", "2000");
echo checkdate("01", "01", "00");


Expected result:
----------------
TRUE
TRUE

Actual result:
--------------
TRUE
FALSE

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-10 22:22 UTC] php at skay dot se
-Summary: Wrong if year is two digits and year is 2000 +Summary: checkdate(): Wrong if year is two digits and year is 2000 -PHP Version: Irrelevant +PHP Version: 5.3.10
 [2012-10-10 22:22 UTC] php at skay dot se
Description:
------------
---
From manual page: http://www.php.net/function.checkdate
---

If year is 2000 the function will return TRUE (provided the rest is valid) - Thats good!
But if year is 00 the function will always return FALSE


Test script:
---------------
echo checkdate("01", "01", "2000");
echo checkdate("01", "01", "00");


Expected result:
----------------
TRUE
TRUE

Actual result:
--------------
TRUE
FALSE
 [2012-10-11 11:25 UTC] ewgraf at gmail dot com
Seems not a bug.

From manual:
> 'year' The year is between 1 and 32767 inclusive.

int from "00" will be 0
 [2013-10-01 15:29 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-10-01 15:29 UTC] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 06:03:45 2021 UTC