|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-09-21 02:39 UTC] laruence@php.net
-Status: Open
+Status: Duplicate
[2011-09-21 02:39 UTC] laruence@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 17:00:01 2025 UTC |
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