Bug #80505 [NEW]: BUG
| From: | juergen dot wilmsmann at juergenwilmsmann dot de | Date: | Fri, 11 Dec 2020 12:38:02 +0000 |
| Subject: | Bug #80505 [NEW]: BUG | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231013@lists.php.net to get a copy of this message | ||
From: juergen dot wilmsmann at juergenwilmsmann dot de
Operating system:
PHP version: 7.4.13
Package: Unknown/Other Function
Bug Type: Bug
Bug description:BUG
Description:
------------
---
From manual page: https://php.net/function.array-search
---
If in array integer 0 exists before the searched value exists,
the search stopped by integer 0 and give as the result the key of
integer 0.
Test script:
---------------
$arr[1] = "a";
$arr[2] = 0;
$arr[3] = "c";
$arr[4] = "d";
$key = array_search("c", $arr);
//Result is 2 - !!! Wrong !!!
$arr[1] = "a";
$arr[2] = "";
$arr[3] = "c";
$arr[4] = "d";
$key = array_search("c", $arr);
//Result is 3 - OK
$arr[1] = "a";
$arr[2] = "";
$arr[3] = "c";
$arr[4] = 0;
$key = array_search("c", $arr);
//Result is 3 - OK
--
Edit bug report at https://bugs.php.net/bug.php?id=80505&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80505&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80505&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80505&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80505&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80505&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80505&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80505&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80505&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80505&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80505&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80505&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80505&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80505&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80505&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80505&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80505&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80505&r=mysqlcfg