#50813 [Fbk->Opn]: __get called on isset($obj->test[0]) (__isset not tested before)
ID: 50813
User updated by: marc dot bennewitz at giata dot de
Reported By: marc dot bennewitz at giata dot de
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.1
New Comment:
Thats the same:
>php -v
PHP 5.3.3-dev (cli) (built: Jan 21 2010 12:52:05)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
>php test.php
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)
Previous Comments:
------------------------------------------------------------------------
[2010-01-21 09:59:53] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2010-01-21 09:10:17] marc dot bennewitz at giata dot de
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 this bug report at http://bugs.php.net/?id=50813&edit=1
Thread (8 messages)