ID:               29421
 Updated by:       [EMAIL PROTECTED]
 Reported By:      redeye at erisx dot de
-Status:           Open
+Status:           Verified
 Bug Type:         Arrays related
 Operating System: *
 PHP Version:      5.0.0
 New Comment:

This will be more or less "Won't Fix" since it relies on the internal
zend function for type comparison and according to the type juggling
rules of PHP this is valid but not straight forward for anyone (even
for me).


Previous Comments:
------------------------------------------------------------------------

[2004-07-28 08:26:44] redeye at erisx dot de

Description:
------------
When using array_search with strict set to FALSE will allways return
the first matching element of an array, which is absolutly correct, but
will also match every (boolean) TRUE value of an array (which is bad).
This way, you could either hope no value is set to (boolean) TRUE or
are forced to enable strict, which is not allways desired.

This behavoir should either be better documented ( as is the behavior
of FALSE ( "" , 0 , -1 , FALSE ) or changed to only match against ( "1"
, 1 , "TRUE" , TRUE ).

Reproduce code:
---------------
$array = array ( 'foo' , TRUE , 'bar' ) ;
$search = array_search ( 'baz' , $array ) ;

var_dump ( $search ) ;

Expected result:
----------------
bool(false)

Actual result:
--------------
int(1) 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29421&edit=1

Reply via email to