|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-11 15:46 UTC] iliaa@php.net
[2006-06-11 16:47 UTC] matthias dot etienne at gmail dot com
[2011-04-18 15:45 UTC] kjakobi at goodgamestudios dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 13:00:01 2025 UTC |
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)