From: sidou at sidou dot com
Operating system: LINUX or WIN32
PHP version: 4.3.4
PHP Bug Type: Variables related
Bug description: What's wrong with 08 and 09 ?
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 ?
--
Edit bug report at http://bugs.php.net/?id=27434&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27434&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27434&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27434&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27434&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27434&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27434&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27434&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27434&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27434&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27434&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27434&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27434&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27434&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27434&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27434&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27434&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27434&r=float