From:             jlamberg at cc dot helsinki dot fi
Operating system: WinXP Pro
PHP version:      4CVS-2003-09-14 (stable)
PHP Bug Type:     Date/time related
Bug description:  Function checkdate() accepts float values as valid parameters

Description:
------------
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";
else
  echo "Invalid date";

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

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

-- 
Edit bug report at http://bugs.php.net/?id=25530&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25530&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25530&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25530&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25530&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25530&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25530&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25530&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25530&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25530&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25530&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25530&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25530&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25530&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25530&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25530&r=gnused

Reply via email to