php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48986 incorrect return values
Submitted: 2009-07-20 13:53 UTC Modified: 2009-07-20 13:58 UTC
From: bansalcooldheeraj at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.10 OS: ubuntu
Private report: No CVE-ID: None
 [2009-07-20 13:53 UTC] bansalcooldheeraj at gmail dot com
Description:
------------
array_search() has a bug
as it may return 0 if it doesn't find the value but 0 is also a valid index in an array and if element is present at index 0 then also it should return 0 so this way how one can identify whether returned 0 is for not able to find or it is at index 0.

Reproduce code:
---------------
http://www.php.net/manual/en/function.array-search.php


Expected result:
----------------
Please refer description

Actual result:
--------------
Please refer description

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-20 13:58 UTC] felipe@php.net
It's not a bug. Read the warning section in the "Return value" part of this the doc. page.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 08:00:03 2025 UTC