php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18259 array_search doesnt search in arrayindex[0]
Submitted: 2002-07-10 05:13 UTC Modified: 2002-07-10 06:02 UTC
From: schizo at psykick dot de Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.2.1 OS: Windows2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: schizo at psykick dot de
New email:
PHP Version: OS:

 

 [2002-07-10 05:13 UTC] schizo at psykick dot de
array_search doesnt search the first index (0) of an array.
example:
url: test.php?action=new&state=ok&module=1

test.php:
...
$page_params=array_merge($HTTP_POST_VARS,$HTTP_GET_VARS);
//merge is not the problem

array_search("state",array_keys($page_params));
//result: true -> its ok

array_search("action",array_keys($page_params));
//result: false -> BUG

array_keys() works correct (I checked this), the problem is the array_search().



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-10 06:02 UTC] sander@php.net
It doesn't return false, it returns 0 (because the value you're looking for has index 0). 0 evaluates to false. Use array_search(...) === false.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC