From: [EMAIL PROTECTED]
Operating system: Red Hat Linux
PHP version: 4.2.0
PHP Bug Type: Variables related
Bug description: Switch fails when variable being switched equals zero
The following lines of code produce this:
"filled equals zero"
$filled = 0;
if($filled == 0){
echo "filled equals zero";
}
switch($filled){
case $filled == 0:
echo "filled equals zero also"
break;
}
As far as I can tell, there is no reason why that case isn't satisfied -
$filled DOES equal 0, as the if statement proves, yet "filled equals zero
also" never appears on the page. However, replacing "case $filled == 0:"
with "case 0:" does work. This can only be a bug.
--
Edit bug report at http://bugs.php.net/?id=16843&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16843&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16843&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16843&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16843&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16843&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16843&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16843&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16843&r=submittedtwice