From: vbaryshev at list dot ru
Operating system: Windows XP
PHP version: 6CVS-2008-01-17 (snap)
PHP Bug Type: *General Issues
Bug description: Object model
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 bug report at http://bugs.php.net/?id=43885&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43885&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43885&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43885&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43885&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43885&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43885&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43885&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43885&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43885&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43885&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43885&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43885&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43885&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43885&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43885&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43885&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43885&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43885&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43885&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43885&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43885&r=mysqlcfg