Bug #70798 [NEW]: array_search - positive match on $haystack[0] evalutes to boolean FALSE

From: Date: Tue, 27 Oct 2015 01:03:53 +0000
Subject: Bug #70798 [NEW]: array_search - positive match on $haystack[0] evalutes to boolean FALSE
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196833@lists.php.net to get a copy of this message
From: andreas dot baumgaertner at tisco dot at Operating system: Windows Server 2012 R2 PHP version: 5.6.14 Package: *General Issues Bug Type: Bug Bug description:array_search - positive match on $haystack[0] evalutes to boolean FALSE Description: ------------ array_search - positive match on $haystack[0] evalutes to boolean FALSE the same value at integer array index 1 matches perfectly and evaluates to 1 -- change sample script to $haystack[1] = 'German'; $haystack[2] = 'English'; array_search('german',$haystack_lower) returns 1 now ... Test script: --------------- <?php $haystack = array(); $haystack[0] = 'German'; $haystack[1] = 'English'; $haystack_lower = array_map('strtolower', $haystack); print_r($haystack); print_r('<br>'); print_r($haystack_lower); print_r('<br>'); if (array_search('german',$haystack_lower) != FALSE) { print_r('match'); } ?> -- Edit bug report at https://bugs.php.net/bug.php?id=70798&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70798&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70798&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70798&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70798&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70798&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70798&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70798&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70798&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70798&r=support Expected behavior: https://bugs.php.net/fix.php?id=70798&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70798&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70798&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70798&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70798&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70798&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70798&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70798&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70798&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70798&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70798&r=mysqlcfg

« previous php.bugs (#196833) next »