From: marc-bennewitz at arcor dot de Operating system: linux PHP version: 5.5.4 Package: Arrays related Bug Type: Bug Bug description:array_search returns wrong last key if value it is 0
Description: ------------ array_search returns wrong last key (instead of false) if value it is 0 Test script: --------------- $arr = array( "ONE"=>1, "TWO"=>2, "THREE"=>3, "FOUR"=>4, "FIVE"=>5, "SIX"=>6, "SEVEN"=>7, "EIGHT"=>8, "NINE"=>9, "ZERO"=>0 ); var_dump(array_search('unknown', $arr)); Expected result: ---------------- bool(false) Actual result: -------------- string(4) "ZERO" -- Edit bug report at https://bugs.php.net/bug.php?id=65844&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65844&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65844&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65844&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65844&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65844&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65844&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65844&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65844&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65844&r=support Expected behavior: https://bugs.php.net/fix.php?id=65844&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65844&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65844&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65844&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65844&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65844&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65844&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65844&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65844&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65844&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65844&r=mysqlcfg