From: erick at vmxt dot com Operating system: Windows XP SP2 PHP version: 5.1.4 PHP Bug Type: Variables related Bug description: if structure doing weird stuff
Description: ------------ When comparing number zero with a not empty string, it returns true. Reproduce code: --------------- <?php $something = 0; if($something) { echo $something . "is true. <br />"; } if ("thestring") { echo "thestring is true" . "<br />"; } if ($something == "thestring") { echo "why?" . "<br />"; } if("thestring" == $something) { echo "again why?" . "<br />"; } ?> Expected result: ---------------- thestring is true Actual result: -------------- thestring is true why? again why? -- Edit bug report at http://bugs.php.net/?id=38170&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38170&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38170&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38170&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38170&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38170&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38170&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38170&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38170&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38170&r=support Expected behavior: http://bugs.php.net/fix.php?id=38170&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38170&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38170&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38170&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38170&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38170&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38170&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38170&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38170&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38170&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38170&r=mysqlcfg