php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13567 array_search does not return FALSE as documented, if no entry was found
Submitted: 2001-10-05 14:50 UTC Modified: 2001-10-05 16:14 UTC
From: alvarez at st-oneline dot net Assigned: jeroen (profile)
Status: Closed Package: Arrays related
PHP Version: 4.0.5 OS: Linux 2.2.19
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alvarez at st-oneline dot net
New email:
PHP Version: OS:

 

 [2001-10-05 14:50 UTC] alvarez at st-oneline dot net
script to reproduce the error quickly:

  // won't produce output, is not boolean FALSE
  if (array_search ('a', array ('b')) === FALSE)
     echo 'is boolean FALSE';

  // won't produce output, is not of type boolean
  if (is_bool (array_search ('a', array ('b'))))
     echo 'is boolean';

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-05 16:05 UTC] jeroen@php.net
Use var_dump to check what's actually returned.

NULL is returned, confirmed with latest CVS.

Assigning to myself
 [2001-10-05 16:14 UTC] jeroen@php.net
Fixed in CVS, will be in 4.0.8, and maybe in 4.0.7

(what's the policy on this kind of bugfixes?)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 17:02:17 2025 UTC