From:             
Operating system: Linux
PHP version:      5.3.3
Package:          Semaphore related
Bug Type:         Bug
Bug description:shm_put_var resorce destruction

Description:
------------
I'm putting socket resource or any other resource into shared memory using
shm_put_var and when im using shm_get_var i'm getting (int)0.

Test script:
---------------
Based on script finded on doc site.



<?php

define("FOPEN_RESOURCE", 1);

define("FOPEN_FILEPATH", __FILE__);



$fopen_resource = fopen(FOPEN_FILEPATH, "r");



var_dump($fopen_resource);



$shm_id = shm_attach(1);

if ($shm_id === false)

{

    echo "Fail to attach shared memory.\n";

}



if (!shm_put_var($shm_id, FOPEN_RESOURCE, $fopen_resource))

{

    echo "Failed to put var 1 in shared memory $shm_id.\n";

}



$sm_fopen_resource = shm_get_var($shm_id, FOPEN_RESOURCE);

if ($sm_fopen_resource === false)

{

    echo "Failed to retreive fopen_resource from Shared memory\r\n";

}



var_dump($sm_fopen_resource);



if($shm_id) shm_remove($shm_id);

if($fopen_resource) fclose($fopen_resource);





?>

Expected result:
----------------
resource(5) of type (stream)

resource(5) of type (stream)

Actual result:
--------------
resource(5) of type (stream)

int(0)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52635&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52635&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52635&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52635&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52635&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52635&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52635&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52635&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52635&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52635&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52635&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52635&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52635&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52635&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52635&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52635&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52635&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52635&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52635&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52635&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52635&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52635&r=mysqlcfg

Reply via email to