From:             marc dot bennewitz at giata dot de
Operating system: Linux
PHP version:      5.3.1
PHP Bug Type:     Scripting Engine problem
Bug description:  __get called on isset($obj->test[0])  (__isset not tested 
before)

Description:
------------
On testing if an array key is available on an overloaded object variable
it doesn't check __isset before calling __get to get the variable for
checking the array key.

Reproduce code:
---------------
class MyClass
{

    public function __isset($varname)
    {
        echo 'isset' . PHP_EOL;
        return false;
    }

    public function __get($varname)
    {
        trigger_error('Key "' . $varname . '" does not exist',
E_USER_NOTICE);
    }

}

$obj = new MyClass();
var_dump( isset($obj->test[0]) );

Expected result:
----------------
isset
bool(false)

Actual result:
--------------
PHP Notice:  Key "test" does not exist in /tmp/test.php on line 14

Notice: Key "test" does not exist in /tmp/test.php on line 14
bool(false)

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

Reply via email to