#38907 [NEW]: Somewhat misleading notice message with type conversions
| From: | smlerman at gmail dot com | Date: | Wed, 20 Sep 2006 19:13:45 +0000 |
| Subject: | #38907 [NEW]: Somewhat misleading notice message with type conversions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-102490@lists.php.net to get a copy of this message | ||
From: smlerman at gmail dot com
Operating system: Windows (presumably others)
PHP version: 5.1.6
PHP Bug Type: Variables related
Bug description: Somewhat misleading notice message with type conversions
Description:
------------
If you try to compare an object to a string, the error message says that
the object could not be converted to an int. It makes it a little more
difficult to debug code when you're looking for a comparison involving an
integer instead of a string. Nothing really major, but a would-be-nice
kind of fix.
Reproduce code:
---------------
<?php
class Foo{}
$obj = new Foo();
if ($obj == "blah"){
echo "foo";
} else{
echo "bar";
}
?>
Expected result:
----------------
Notice: Object of class Foo could not be converted to string in
int_convert.php on line 7
Actual result:
--------------
Notice: Object of class Foo could not be converted to int in
int_convert.php on line 7
--
Edit bug report at http://bugs.php.net/?id=38907&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38907&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38907&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38907&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38907&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38907&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38907&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38907&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38907&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38907&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38907&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38907&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38907&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38907&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38907&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38907&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38907&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38907&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38907&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38907&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38907&r=mysqlcfg