From:             
Operating system: Windows and Freebsd
PHP version:      Irrelevant
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:string is equals a 0 !?

Description:
------------
// tested both in

// in windows 7 - php 5.2.12.12

// in freebsd 7 - php 5.3.3



// because 'e' equals zero, zero is false and false is not equal to 'e'



var_dump(0 == 'e'); // true

var_dump(false == 0); // true

var_dump(false == 'e'); // false

echo '<hr>';



// this means that when we compare int to string will always be equal?



var_dump(0 == "e"); // true

var_dump(0 == "Bernardo"); // true



what is the meaning of this? I think it should not return true.



Test script:
---------------
<?

var_dump(0 == 'e'); // true

?>

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

Actual result:
--------------
bool(true) 

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54625&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54625&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54625&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54625&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54625&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54625&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54625&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54625&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54625&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54625&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54625&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54625&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54625&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54625&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54625&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54625&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54625&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54625&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54625&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54625&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54625&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54625&r=mysqlcfg

Reply via email to