#50813 [Opn->Fbk]: __get called on isset($obj->test[0]) (__isset not tested before)
| From: | jani@php.net | Date: | Thu, 21 Jan 2010 09:59:53 +0000 |
| Subject: | #50813 [Opn->Fbk]: __get called on isset($obj->test[0]) (__isset not tested before) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146840@lists.php.net to get a copy of this message | ||
ID: 50813
Updated by: jani@php.net
Reported By: marc dot bennewitz at giata dot de
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.1
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[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