#49657 [Opn->Bgs]: array_search returns null instead of false

From: Date: Thu, 24 Sep 2009 12:17:23 +0000
Subject: #49657 [Opn->Bgs]: array_search returns null instead of false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142822@lists.php.net to get a copy of this message
ID: 49657 Updated by: pajoye@php.net Reported By: pvenakis at efrontlearning dot net -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: windows PHP Version: 5.3.0 New Comment: That's expected. Returning NULL on invalid argument(s) is correct. Previous Comments: ------------------------------------------------------------------------ [2009-09-24 12:03:47] pvenakis at efrontlearning dot net Description: ------------ array_search returns false in 5.2.x, null in 5.3.0, when $haystack is not an array Reproduce code: --------------- $haystack = false; //Anything not an array $result = array_search(1, $haystack); var_dump($result); Expected result: ---------------- bool(false) Actual result: -------------- null ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49657&edit=1

« previous php.bugs (#142822) next »