Edit report at http://bugs.php.net/bug.php?id=37777&edit=1

 ID:                 37777
 Comment by:         kjakobi at goodgamestudios dot com
 Reported by:        matthias dot etienne at gmail dot com
 Summary:            shm_put_var does not work with resource vars
 Status:             Bogus
 Type:               Bug
 Package:            Semaphore related
 Operating System:   Debian 3.1
 PHP Version:        5.1.4
 Block user comment: N
 Private report:     N

 New Comment:

The documentation is still wrong..


Previous Comments:
------------------------------------------------------------------------
[2006-06-11 16:47:38] matthias dot etienne at gmail dot com

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.

------------------------------------------------------------------------
[2006-06-11 15:46:06] il...@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/bug.php?id=37777&edit=1

Reply via email to