From: crashrox at gmail dot com Operating system: Tested on Solaris & Windows PHP version: 5.2.5 PHP Bug Type: Class/Object related Bug description: Calling a non static function staticaly causes local assignment
Description: ------------ You have two classes (Class1 and Class2). Class1 calls a non static Class2 function with a Class2 variable assignment, but without a return value. The value set in Class2 is somehow assigned to Class1. If the function was set to static or the class is instantiated the problem does not occur. See code example below for better explanation... Reproduce code: --------------- // UNEXPECTED RESULTS class Class1 { public function __construct() { Class2::dosomething(); } } class Class2 { private $somevar; public function dosomething() { $this->somevar = 'test'; } } $x = new Class1(); print_r($x); /* // WORKS CORRECTLY class Class1 { public function __construct() { $x = new Class2(); $x->dosomething(); } } class Class2 { private $somevar; public function dosomething() { $this->somevar = 'test'; } } $x = new Class1(); print_r($x); */ Expected result: ---------------- Class1 Object ( ) Actual result: -------------- Class1 Object ( [somevar] => test ) -- Edit bug report at http://bugs.php.net/?id=43554&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43554&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43554&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43554&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43554&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43554&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43554&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43554&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43554&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43554&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43554&r=support Expected behavior: http://bugs.php.net/fix.php?id=43554&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43554&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43554&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43554&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43554&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43554&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43554&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43554&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43554&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43554&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43554&r=mysqlcfg