From:             joshdf at gmail dot com
Operating system: win xp
PHP version:      5.0.3
PHP Bug Type:     Variables related
Bug description:  isset incorrectly returning true when passed a bad type

Description:
------------
isset may return true to a $string->member being passed in.  Clearly, a
string can not have a member variable; therefore, isset is expected to
always return false in this case.  The actual result of the reproduced
code for us is incorrect when using php 5.0.3, while the expected correct
result is produced in php 5.0.0.

Reproduce code:
---------------
<?php
class Car
{
        var $mpg;
}
$car = new Car();
$car->mpg = 30;

//the normal case, should work
if( isset($car->mpg) )
        echo "mpg is set...this is normal<br>";

//the case that may not work right:
$some_random_string = "this is some random string, it has no mpg member";
if( isset($some_random_string->mpg) )
        echo "ERROR: This line should never be displayed<br>";
?>

Expected result:
----------------
mpg is set...this is normal

Actual result:
--------------
mpg is set...this is normal
ERROR: This line should never be displayed

-- 
Edit bug report at http://bugs.php.net/?id=31436&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31436&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31436&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31436&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31436&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31436&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31436&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31436&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31436&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31436&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31436&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31436&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31436&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31436&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31436&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31436&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31436&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31436&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31436&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31436&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31436&r=mysqlcfg

Reply via email to