#43885 [Opn->Bgs]: Object model
| From: | tony2001@php.net | Date: | Mon, 28 Jan 2008 23:30:28 +0000 |
| Subject: | #43885 [Opn->Bgs]: Object model | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121632@lists.php.net to get a copy of this message | ||
ID: 43885
Updated by: tony2001@php.net
Reported By: vbaryshev at list dot ru
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Windows XP
PHP Version: 6CVS-2008-01-17 (snap)
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
http://www.php.net/manual/en/language.oop5.overloading.php
Previous Comments:
------------------------------------------------------------------------
[2008-01-17 21:34:38] vbaryshev at list dot ru
Description:
------------
Some bugs with __get(), __set()
Reproduce code:
---------------
class Test1
{
public function __construct() { }
public function test()
{
$this->Prop = 'test';
echo $this->Prop;
echo isset($this->Prop);
echo !empty($this->Prop);
echo $this->Prop;
}
}
class Test2 extends Test1
{
private $prop;
public function __construct() { }
public function __get($name)
{
$name{0} = strtolower($name{0}); // Property called with first
symbol upper case
switch ($name)
{
case "prop" :
return $this->prop;
break;
}
}
public function __set($name, $value)
{
$name{0} = strtolower($name{0}); // Property called with first
symbol upper case
switch ($name)
{
case "prop" :
$this->prop = $value;
break;
}
}
}
$obj = new Test2();
$obj->test();
Expected result:
----------------
test
{false}
{false}
test
Actual result:
--------------
test
1
1
test
Íàëè÷èå ñâîéñòâ íå ðàñïîçíàþòñÿ ñòàíäàðòíûìè
ôóíêöèÿìè, ÷òî ÿâëÿåòñÿ
íåâåðíûì ñ ëîãè÷åñêîé òî÷êè çðåíèÿ è çàòðóäíÿåò
ïðîâîäèòü íåêîòîðûå
ïðîâåðêè ñ ïðàêòè÷åñêîé òî÷êè çðåíèÿ.
Sory, my english very bad :(
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43885&edit=1