ID: 37777 Updated by: [EMAIL PROTECTED] Reported By: matthias dot etienne at gmail dot com -Status: Open +Status: Bogus Bug Type: Semaphore related Operating System: Debian 3.1 PHP Version: 5.1.4 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 You cannot store resources in shared memory. Previous Comments: ------------------------------------------------------------------------ [2006-06-11 00:44:28] matthias dot etienne at gmail dot com Description: ------------ You cannot store var of type resource or retrieve a var of type resource with shm_put_var or shm_get_var. It always returns a int(0). Reproduce code: --------------- <?php $SHM_KEY = ftok(__FILE__, chr( 4 ) ); $data = shm_attach($SHM_KEY, 1024, 0666); $test1 = array("hello","world","1","2","3"); $test2 = array("hello","world","4","5","6"); $test3 = fopen('t.bla', 'w'); shm_put_var($data, 1, $test1); shm_put_var($data, 2,$test2); shm_put_var($data, 3,$test3); print_r(shm_get_var($data, 1)); print_r(shm_get_var($data, 2)); var_dump(shm_get_var($data, 3)); fclose($test3); shm_detach($data); ?> Expected result: ---------------- Array ( [0] => hello [1] => world [2] => 1 [3] => 2 [4] => 3 ) Array ( [0] => hello [1] => world [2] => 4 [3] => 5 [4] => 6 ) resource(6) of type (stream) Actual result: -------------- Array ( [0] => hello [1] => world [2] => 1 [3] => 2 [4] => 3 ) Array ( [0] => hello [1] => world [2] => 4 [3] => 5 [4] => 6 ) int(0) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37777&edit=1