From:
Operating system: Fedora 15
PHP version: 5.3.8
Package: *General Issues
Bug Type: Bug
Bug description:issue with __get on unset property
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 bug report at https://bugs.php.net/bug.php?id=55746&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55746&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55746&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=55746&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55746&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=55746&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55746&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=55746&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=55746&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=55746&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=55746&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=55746&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=55746&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=55746&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55746&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=55746&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55746&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=55746&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=55746&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=55746&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=55746&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=55746&r=mysqlcfg