From:             tiramon at gmx dot net
Operating system: UNIX/WIN
PHP version:      5.2.4
PHP Bug Type:     Arrays related
Bug description:  in_array returns true in false case

Description:
------------
if ( in_array( "1a", array(1) ) )
{
  echo "ok";
}

returns ok 

I know that it returns true if i compare "1" with 1 (string with int) and
that there is a third parameter to avoid this.

Bot imho "1a" and 1 are completly different and should even without type
compare return false

I tried this on a unix system with 5.2.0 and just to check if it was fixed
in the current version with 5.2.4 at a win system

Reproduce code:
---------------
just execute 

if ( in_array( "1a", array(1) ) )
{
  echo "ok";
}

Expected result:
----------------
No Output

Actual result:
--------------
script echoed "ok"

-- 
Edit bug report at http://bugs.php.net/?id=42903&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42903&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42903&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42903&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42903&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42903&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42903&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42903&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42903&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42903&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42903&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42903&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42903&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42903&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42903&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42903&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42903&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42903&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42903&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42903&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42903&r=mysqlcfg

Reply via email to