php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30294 GregorianToJD returning value for date that does not exist
Submitted: 2004-09-30 22:05 UTC Modified: 2004-10-01 20:10 UTC
From: garrettblits at yahoo dot com Assigned:
Status: Not a bug Package: Calendar related
PHP Version: 5.0.2 OS: RedHat 8.0
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:
MUST BE VALID
Solve the problem:
28 + 27 = ?
Subscribe to this entry?

 
 [2004-09-30 22:05 UTC] garrettblits at yahoo dot com
Description:
------------
This function (GregorianToJD) will return a value for a date that does not exist.

Reproduce code:
---------------
$x = GregorianToJD(02,29,1998);
$y = JDToGregorian($x);

echo "$x - $y";

Expected result:
----------------
Nothing or an error: 02/29/1998 does not exist

Actual result:
--------------
2450874 - 3/1/1998

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-01 09:04 UTC] derick@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

This is consistent with how the other date functions handle overflows.
 [2004-10-01 20:10 UTC] garrettblits at yahoo dot com
I have checked the documentation and no where in it does it say anything about how overflows are handled. Including such advisments in the documentation could be usefull.

Opinion: I do understand there are other functions to check dates prior to using a function like this one. However, it seems wrong to have a calendar function which returns anything but an error(false) when given a "bogus" date as input.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 22:01:29 2024 UTC