#28176 [Opn->Bgs]: isset() returns false for properties returned from __get()
| From: | derick@php.net | Date: | Tue, 27 Apr 2004 06:32:01 +0000 |
| Subject: | #28176 [Opn->Bgs]: isset() returns false for properties returned from __get() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58848@lists.php.net to get a copy of this message | ||
ID: 28176
Updated by: derick@php.net
Reported By: benjcarson at digitaljunkies dot ca
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 5CVS-2004-04-27 (dev)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is correct behavior, isset() does not call the __get and __set
handlers.
Previous Comments:
------------------------------------------------------------------------
[2004-04-27 03:57:42] benjcarson at digitaljunkies dot ca
Description:
------------
isset() returns false for variables that are returned using the __get()
method, even though the variables are set and their values are returned
properly.
Reproduce code:
---------------
<?php
class Foo { var $arr; function __get($var) { return $this->arr[$var]; }
}
class Bar { var $var; function __get($tmp) { return $this->var; } }
$f = new Foo();
$f->arr["key"] = "val";
var_dump($f->key); // Value returned correctly
var_dump(isset($f->key)); // isset() disagrees
$b = new Bar();
$b->var = "blah";
var_dump($b->dummy); // Value returned correctly
var_dump(isset($b->dummy)); // isset() returns false
?>
Expected result:
----------------
string(3) "val"
bool(true)
string(4) "blah"
bool(true)
Actual result:
--------------
string(3) "val"
bool(false)
string(4) "blah"
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28176&edit=1