ID: 28050 Updated by: [EMAIL PROTECTED] Reported By: mmertinkat at justseven dot de -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 4.3.6 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. Please read the manual about references (what they are, what they are not, when to use, when not to use..) Previous Comments: ------------------------------------------------------------------------ [2004-04-18 17:38:04] mmertinkat at justseven dot de Description: ------------ Just look at the code; it is reproducible with PHP 4.3.4, 4.3.5 and 4.3.6 on Windows and Linux. Reproduce code: --------------- <? $data = NULL; $data['settings']['account']['firstname'] = 'Johnny'; $data['settings']['account']['lastname'] = 'Walker'; $data['settings']['account']['username'] = 'johnny'; $data['settings']['account']['password'] = 'not secret'; /**********************************************/ print_r($data); $settings = $data['settings']; $account = &$settings['account']; // we're now going to change the account password and therefore // use the $account array as a "shortcut" (reference) to $settings['account'] $account['password'] = 'secret'; // write any changes into the data array $data['settings'] = $settings; /******************/ // the following two lines will (mistakenly?) touch the $data array ... $mysettings = $data['settings']; $mysettings['account']['password'] = 'very secret'; // ... whereas the next two lines don't change anything (as it should be) $myaccount = $data['settings']['account']; $myaccount['password'] = 'very very secret'; print_r($data); ?> Expected result: ---------------- Array ( [settings] => Array ( [account] => Array ( [firstname] => Johnny [lastname] => Walker [username] => johnny [password] => not secret ) ) ) Array ( [settings] => Array ( [account] => Array ( [firstname] => Johnny [lastname] => Walker [username] => johnny [password] => secret ) ) ) Actual result: -------------- Array ( [settings] => Array ( [account] => Array ( [firstname] => Johnny [lastname] => Walker [username] => johnny [password] => not secret ) ) ) Array ( [settings] => Array ( [account] => Array ( [firstname] => Johnny [lastname] => Walker [username] => johnny [password] => very secret ) ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28050&edit=1