php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27434 What's wrong with 08 and 09 ?
Submitted: 2004-02-29 01:01 UTC Modified: 2004-02-29 03:25 UTC
From: sidou at sidou dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.4 OS: LINUX or WIN32
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sidou at sidou dot com
New email:
PHP Version: OS:

 

 [2004-02-29 01:01 UTC] sidou at sidou dot com
Description:
------------
Try the script below using a form input page with a field for the variable $month and point the action to a page containing the script. Try all the cases and see the result for the value of $month = 08 and $month = 09.
And try also to input "00" or "any string".

For god sake I want to know what's wrong with this code ?

Reproduce code:
---------------
<?
switch ($month){ 
case (01): 
$mon="jan"; 
break;
case (02): 
$mon="feb"; 
break;
case (03): 
$mon="mar"; 
break;
case (04): 
$mon="apr"; 
break;
case (05): 
$mon="may"; 
break;
case (06): 
$mon="jun"; 
break;
case (07): 
$mon="jul"; 
break;
case (08): 
$mon="aug"; 
break;
case (09): 
$mon="sep"; 
break;
case (10): 
$mon="oct"; 
break;
case (11): 
$mon="nov"; 
break;
case (12): 
$mon="dec"; 
break;
default: 
print "INVALIDE MONTH !!";
}
echo ($mon);
echo ($month);
?>

Expected result:
----------------
I expect to see a logical output regarding to the simple code above, I want to see the script printing "aug08" when I insert the value "08" for the month in the form. same thing for "09".

and when we put "00", "any string" or BLANK the output is "aug + USED_STRING"

Why all other values work fine ?

Actual result:
--------------
Actually, when we input $month = 08 the result is "WRONG MONTH08" even though the case was correctly predicted in the code. Same thing for "09".

Does PHP have any problem with August and September ?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-29 03:25 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

RTFM:
http://nl.php.net/types.integer
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC