ID:               16130
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Assigned
 Bug Type:         Documentation problem
 Operating System: Linux 2.4.12 / 2.4.17
 PHP Version:      4.1.2
 Assigned To:      philip
 New Comment:

Works for me with 4.3.0-dev too.

Derick


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

[2002-03-17 22:50:51] [EMAIL PROTECTED]

This bug was fixed by Jeroen on Oct 5, 2001 as stated under bug #13567.
 Assigning to self for a little more testing, this change took place in
4.2.0 and will be documented as such.  Good thing in PHP everyone uses
== :))

<?php
  $return = array_search('sorry', array('foo','bar'));

  print '$return is type: '. gettype($return) ."\n";
  if ($return === false) print "\$return === false\n";
  if ($return === NULL)  print "\$return === NULL\n";
  /*
    X-Powered-By: PHP/4.2.1-dev (3-17)
     $return is type: boolean
     $return === false

    X-Powered-By: PHP/4.1.2
     $return is type: NULL
     $return === NULL
  */
?>

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

[2002-03-17 21:08:16] [EMAIL PROTECTED]

I am calling array_search.  I expect it to return FALSE if the needle
value is not in the haystack (as documented) -- it's not happening.

I searched the bug database and found this bug (#13567) reported for v.
4.0.5 and marked as closed, but the bug is still present in 4.1.2.

Script that demonstrates the problem:

$result = array_search( "M", array( "A", "Z" ) );

if ( $result === false ) {

  echo "REALLY FALSE";

}

else {

  echo "SOMETHING ELSE";

}


I expect the script to output "REALLY FALSE", instead it outputs
"SOMETHING ELSE".

Thanks.

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


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

Reply via email to