From:             matthias dot etienne at gmail dot com
Operating system: Debian 3.1
PHP version:      5.1.4
PHP Bug Type:     Semaphore related
Bug description:  shm_put_var does not work with resource vars

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 bug report at http://bugs.php.net/?id=37777&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37777&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37777&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37777&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37777&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37777&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37777&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37777&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37777&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37777&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37777&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37777&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37777&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37777&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37777&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37777&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37777&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37777&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37777&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37777&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37777&r=mysqlcfg

Reply via email to