Bug->Doc #52635 [Opn]: shm_put_var resorce destruction
| From: | felipe@php.net | Date: | Thu, 19 Aug 2010 00:27:58 +0000 |
| Subject: | Bug->Doc #52635 [Opn]: shm_put_var resorce destruction | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4887@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52635&edit=1
ID: 52635
Updated by: felipe@php.net
Reported by: michal dot zaloudik at gmail dot com
Summary: shm_put_var resorce destruction
Status: Open
-Type: Bug
+Type: Documentation Problem
-Package: Semaphore related
+Package: Documentation problem
Operating System: Linux
PHP Version: 5.3.3
Block user comment: N
New Comment:
The doc needs be fixed.
Not all datatypes are supported (as is said in the doc), resource cannot
be used. (As the variable is serialized to be put into shared memory)
Previous Comments:
------------------------------------------------------------------------
[2010-08-18 15:56:42] michal dot zaloudik at gmail dot com
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 this bug report at http://bugs.php.net/bug.php?id=52635&edit=1