From:             decryptus at gmail dot com
Operating system: Linux debian
PHP version:      4.4.0
PHP Bug Type:     Unknown/Other Function
Bug description:  Error in control structures between integer and string

Description:
------------
I have a problem when I compare two variables, one is an integer the other
is a string.

So when I do a "if" between these variables, the result is true.

I use '==' to compare these variables, I can use '===', but in the logic
two differents values should'nt be true.

Reproduce code:
---------------
-------------------
$foo_1 = 2005; # an integer
$foo_2 = '2005-10'; # a string

if($foo_1 == $foo_2)
        print 'result true : '.$foo_1;
else
        print 'result false : '.$foo_2;
-------------------


Expected result:
----------------
# foo_2's value :
result false : 2005-10

Actual result:
--------------
# foo_1's value :
result true : 2005

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

Reply via email to