Bug #55746 [Opn->Dup]: issue with __get on unset property
| From: | laruence@php.net | Date: | Wed, 21 Sep 2011 02:39:03 +0000 |
| Subject: | Bug #55746 [Opn->Dup]: issue with __get on unset property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-163733@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55746&edit=1
ID: 55746
Updated by: laruence@php.net
Reported by: hytest at gmail dot com
Summary: issue with __get on unset property
-Status: Open
+Status: Duplicate
Type: Bug
Package: *General Issues
Operating System: Fedora 15
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
this is a dup to #55731, plz see it
Previous Comments:
------------------------------------------------------------------------
[2011-09-21 02:37:04] hytest at gmail dot com
Description:
------------
Test following script please.
It enters __get twice on unset property (class Ex1) but only once on Ex2.
It doesn't really make sense and can't find any word in document so I assume it's
a bug.
Test script:
---------------
class Ex1{
private $var;
function __construct(){
unset($this->var);
}
function __get($elmname){
echo "call __get\n";
return $this->$elmname;
}
}
class Ex2{
function __construct(){
}
function __get($elmname){
echo "call __get\n";
return $this->$elmname;
}
}
$ex1=new Ex1();
echo $ex1->var;
$ex2=new Ex2();
echo $ex2->var;
Expected result:
----------------
call __get
PHP Notice: Undefined property: Ex1::$var in /web/sites/test/test1/t5.php on line
12
call __get
PHP Notice: Undefined property: Ex2::$var in /web/sites/test/test1/t5.php on line
24
Actual result:
--------------
call __get
call __get
PHP Notice: Undefined property: Ex1::$var in /web/sites/test/test1/t5.php on line
12
call __get
PHP Notice: Undefined property: Ex2::$var in /web/sites/test/test1/t5.php on line
24
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55746&edit=1