From:             wagner at bonn dot edu
Operating system: Gentoo Linux
PHP version:      5CVS-2005-01-25 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  changes to $name in __get($name) override future parameters

Description:
------------
Changing $name in __get($name) to e.g. "foo", will cause   
the next call of __get() to use "foo" as the name instead   
of the name of the member-Variable that was actually 
called. 
Only intercepted accesses to variables (e.g. 
$obj->doesnt_exist) seem to be affected, not direct calls 
to __get() (e.g. $obj->__get("whatever") ); 
  
Reproducible with PHP 5.0.3, PHP_5_0 CVS and CVS head (PHP  
5.1 dev).  

Reproduce code:
---------------
<?php 
class testclass { 
  public function __get($name) { 
    echo "$name \n"; 
    $name = "wrong";
  } 
} 

$obj = new testclass(); 

for ($i=1; $i <=3; $i++) { 
  $dummy = $obj->correct; 
}
?> 


Expected result:
----------------
correct   
correct  
correct  
 
The line 
$name = "wrong"; 
should have no effect. 

Actual result:
--------------
correct  
wrong  
wrong  
 

-- 
Edit bug report at http://bugs.php.net/?id=31683&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31683&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31683&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31683&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31683&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31683&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31683&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31683&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31683&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31683&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31683&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31683&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31683&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31683&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31683&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31683&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31683&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31683&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31683&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31683&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31683&r=mysqlcfg

Reply via email to