#35746 [NEW]: Comparison of scalars & non-scalars w/o typecast should generate an error

From: Date: Tue, 20 Dec 2005 15:05:22 +0000
Subject: #35746 [NEW]: Comparison of scalars & non-scalars w/o typecast should generate an error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90729@lists.php.net to get a copy of this message
From: schapht at verizon dot net Operating system: Mac OS 10.4.3 PHP version: 5.1.1 PHP Bug Type: Feature/Change Request Bug description: Comparison of scalars & non-scalars w/o typecast should generate an error Description: ------------ When developing I find that comparison of a scalar and non-scalar is often unintentional and usually indicates a mistake elsewhere in the program. It would be nice if comparing scalars and non-scalars generated a low-priority error message. Reproduce code: --------------- <?php class A {} $a = new A; $b = 3; echo $a > $b; ?> Expected result: ---------------- Notice: Comparison of scalar and non-scalar without a typecast. in test.php on line 8 1 Actual result: -------------- 1 -- Edit bug report at http://bugs.php.net/?id=35746&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35746&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35746&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35746&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35746&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35746&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35746&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35746&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35746&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35746&r=support Expected behavior: http://bugs.php.net/fix.php?id=35746&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35746&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35746&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35746&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35746&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35746&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35746&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35746&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35746&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35746&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35746&r=mysqlcfg

« previous php.bugs (#90729) next »