php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52635 shm_put_var resorce destruction
Submitted: 2010-08-18 15:56 UTC Modified: 2010-10-20 04:09 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: michal dot zaloudik at gmail dot com Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.3 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michal dot zaloudik at gmail dot com
New email:
PHP Version: OS:

 

 [2010-08-18 15:56 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-19 02:27 UTC] felipe@php.net
-Type: Bug +Type: Documentation Problem -Package: Semaphore related +Package: Documentation problem
 [2010-08-19 02:27 UTC] felipe@php.net
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)
 [2010-10-20 04:09 UTC] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=304523
Log: Fixed bug #52635 (shm_put_var resorce destruction)
 [2010-10-20 04:09 UTC] kalle@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2010-10-20 04:09 UTC] kalle@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:09 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=509560882548428427e86b83d65f59aa757e0b40
Log: Fixed bug #52635 (shm_put_var resorce destruction)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 19 22:00:03 2025 UTC