From: kupka at learninglab dot de Operating system: Mac OS X PHP version: 5.0.0RC1 PHP Bug Type: Zend Engine 2 problem Bug description: New object model fails - old style works fine
Description: ------------ You have a main object which includes some other objects. This object is stored in the session. The other objects have a reference to the main object. If you start a new session these references should point to the main object. If you pass the objects to the main object in the old style with "&" this works fine. If you use the new style without "&" it doesn't work as exspected. Reproduce code: --------------- The classes: class CHello { var $store; // this doesn't work as exspected public function CHello($store) { $this->store = $store; } /* // this works fine public function CHello(&$store) { $this->store =& $store; } */ public function hello( ) { $v = $this->store->value; echo "Hello World: value is $v. (store id: $this->store)<br>"; } } class CStore { var $object1; var $object2; var $value = 0; } --------------------------- The first script: session_start(); $store = new CStore; $hello1 = new CHello($store); $hello2 = new CHello($store); $store->value = 999; $store->object1 = $hello1; $store->object2 = $hello2; echo "store id: $store<br>"; $store->object1->hello(); $store->object2->hello(); session_register("store"); --------------------------- The second script: session_start(); $store->value = 123; echo "store id: $store<br>"; echo $store->object1->hello(); echo $store->object2->hello(); Expected result: ---------------- The first script where the objects are generated: store id: Object id #4 Hello World: value is 999. (store id: Object id #4) Hello World: value is 999. (store id: Object id #4) The second script: store id: Object id #1 Hello World: value is 123. (store id: Object id #1) Hello World: value is 123. (store id: Object id #1) Actual result: -------------- The first script where the objects are generated: store id: Object id #6 Hello World: value is 999. (store id: Object id #6) Hello World: value is 999. (store id: Object id #6) The second script: store id: Object id #1 Hello World: value is 999. (store id: Object id #3) Hello World: value is 999. (store id: Object id #5) -- Edit bug report at http://bugs.php.net/?id=28106&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28106&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28106&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28106&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28106&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28106&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28106&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28106&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28106&r=support Expected behavior: http://bugs.php.net/fix.php?id=28106&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28106&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28106&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28106&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28106&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28106&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28106&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28106&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28106&r=float