#44569 [NEW]: Evaluation of String as Switch/Case Parameter

From: Date: Sun, 30 Mar 2008 11:06:58 +0000
Subject: #44569 [NEW]: Evaluation of String as Switch/Case Parameter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123776@lists.php.net to get a copy of this message
From: soenke at brecht dot it Operating system: Unix/Windows PHP version: 5.2.5 PHP Bug Type: Scripting Engine problem Bug description: Evaluation of String as Switch/Case Parameter Description: ------------ Case seems to evaluate only parts of the given case name against the in case given comparator. In the given example it aways runs into the first case, comparing only the first four characters of both strings. Reproduce code: --------------- decide("Items"); decide("Item"); decide("some"); function decide ($parameter){ Switch($parameter){ case "Items": echo "These are all items \n"; break; case "Item": echo "A single Item \n"; break; default: echo "not listed"; }//end switch }//end function Expected result: ---------------- These are all items A single item not listed Actual result: -------------- These are all items These are all items not listed -- Edit bug report at http://bugs.php.net/?id=44569&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44569&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44569&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44569&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44569&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44569&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44569&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44569&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44569&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44569&r=support Expected behavior: http://bugs.php.net/fix.php?id=44569&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44569&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44569&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44569&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44569&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44569&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44569&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44569&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44569&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44569&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44569&r=mysqlcfg

« previous php.bugs (#123776) next »