ID: 26177 Updated by: [EMAIL PROTECTED] Reported By: l_faillie at yahoo dot com -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Solaris 8 PHP Version: 4.3.3 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The non-numeric keys get converted to 0, which causes the variable to be overwritten. Previous Comments: ------------------------------------------------------------------------ [2003-11-08 15:50:36] cunha17 at uol dot com dot br oops! It seems that the second argument should be an integer: int shm_put_var ( int shm_identifier, int variable_key, mixed variable) ------------------------------------------------------------------------ [2003-11-08 12:49:26] l_faillie at yahoo dot com Yes it was my workaround but ... if it's the correct beaviour of this function, what is the usefullness of the second argument ? ------------------------------------------------------------------------ [2003-11-08 12:42:22] cunha17 at uol dot com dot br In fact, you should use an array if you want to store multiple information. Source 1 : storing variables $shm = shm_attach( 2710, 512); $data = array('val'=>'blabla', 'jour'=> date('D')); shm_put_var( $shm, 'data', serialize($data)); Source 2 : reading variables $shm = shm_attach( 2710, 512); $data = unserialize(shm_get_var($shm, 'data')); echo 'val :', $data['val'], "\n"; echo 'jour :', $data['jour'], "\n"; ------------------------------------------------------------------------ [2003-11-08 10:06:05] l_faillie at yahoo dot com Description: ------------ Hi all, It seems only one variable can be stored in a SHM zone. Reproduce code: --------------- Source 1 : storing variables $shm = shm_attach( 2710, 512); shm_put_var( $shm, 'val', 'blabla'); shm_put_var( $shm, 'jour', date('D')); Source 2 : reading variables $shm = shm_attach( 2710, 512); echo 'val :', shm_get_var($shm, 'val'), "\n"; echo 'jour :', shm_get_var($shm, 'jour'), "\n"; Expected result: ---------------- val :blabla jour :Sat Actual result: -------------- val :Sat jour :Sat ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26177&edit=1
