[PHP-BUG] Bug #51515 [NEW]: Testing the equality of a string and an int can fails

[email protected] ("ianbara at imap dot cc") Thu, 8 Apr 2010 23:22:53 +0200 (CEST)
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: Ubuntu Linux
PHP version:      5.3.2
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Testing the equality of a string and an int can fails

Description:
------------
The attached code prints out EQUALS for me. It should not do this. === Does
work 
correctly however.

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

$old = "fca4ed9b761ca8ad209293248c2cdb56"; 
$new = 0;

if ($old == $new)
   echo "EQUALS";
else
   echo "NOT EQUALS"

?>

Expected result:
----------------
NOT EQUALS

Actual result:
--------------
EQUALS

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