php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21350 in_array return false if not array
Submitted: 2003-01-02 14:42 UTC Modified: 2003-01-02 16:08 UTC
From: marc at rushland dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.2.1 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marc at rushland dot net
New email:
PHP Version: OS:

 

 [2003-01-02 14:42 UTC] marc at rushland dot net
When you pass a non-array as the second arguement (i.e. the haystack) to in_array(), I think it would be more useful if PHP simply returned FALSE, instead of issuing a WARNING error.

Checking an array against is_array() before calling in_array() in a conditional expression only leads to more complicated code when I think it is quite logical for PHP to simply return false.

Marc.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-02 16:08 UTC] edink@php.net
You can silence to warning by calling @in_array() if you know what you are doing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 05:01:31 2024 UTC