#37777 [Bgs]: shm_put_var does not work with resource vars
| From: | matthias dot etienne at gmail dot com | Date: | Sun, 11 Jun 2006 16:47:39 +0000 |
| Subject: | #37777 [Bgs]: shm_put_var does not work with resource vars | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98282@lists.php.net to get a copy of this message | ||
ID: 37777
User updated by: matthias dot etienne at gmail dot com
Reported By: matthias dot etienne at gmail dot com
Status: Bogus
Bug Type: Semaphore related
Operating System: Debian 3.1
PHP Version: 5.1.4
New Comment:
I did double-check the documentation and it tells:
shm_put_var() inserts or updates the variable with the given
variable_key. *All* variable-types are supported.
See: http://fr.php.net/manual/en/function.shm-put-var.php
So the documentation is wrong.
Previous Comments:
------------------------------------------------------------------------
[2006-06-11 15:46:06] iliaa@php.net
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.
------------------------------------------------------------------------
[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