ID:               28965
 Comment by:       joe at bs0 dot com
 Reported By:      mauroi at digbang dot com
 Status:           No Feedback
 Bug Type:         Unknown/Other Function
 Operating System: Windows XP
 PHP Version:      5.0.0RC3
 New Comment:

Am experiencing the same problem on windows xp with iis and apache2. 
Tested in php 4.3.11 and the snapshot in the comment above, no
difference.  After calling shmop_delete, memory can still be
opened/read on either the same request, or subsequent ones.(am calling
shmop_close after delete)


Previous Comments:
------------------------------------------------------------------------

[2005-03-05 01:00:06] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2005-02-25 11:19:29] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip



------------------------------------------------------------------------

[2004-06-30 00:14:40] mauroi at digbang dot com

Description:
------------
First of all, when I call shmop_open with the "n" access mode I always
get an error ("cannot create...").
But also, when I create it with the "c" access mode it works ok. Then
(in another execution) I can read that shared memory segment and it
returns the correct data. If I try to delete the segment the function
always return true, but it does not delete it (on the next request I
can read it anyway).
Looking at the process explorer I can see that the apache process
always get a new "Section" called \BaseNamedObjects\TSRM_SHM_DESCRIPTOR
(even if my PHP script is only reading the segment or deleting the
segment, not creating one).

Thanks in advance.

PS. I get the same error on PHP 4 / Windows XP.

Reproduce code:
---------------
I execute the following script 3 times. First with the READ and DELETE
parts commented. Then with WRITE and DELETE parts commented. And
finally with the WRITE and READ parts commented. 
After that if the segments exists anyway.

<?php
class Foo
{
        function Foo()
        {
                $this->a = '43534553';
                $this->b = 'jeqgfhewfg';
        }
}
$foo = new Foo();
$key = CreateKey('var');

/* WRITE */
$content = serialize($foo);
$shmId = shmop_open($key, "c", 0777, strlen($content));
$written = shmop_write($shmId, $content, 0);
shmop_close($shmId);

/* READ */
$shmId = shmop_open($key, 'a', 0, 0);
$content = shmop_read($shmId, 0, shmop_size($shmId));
shmop_close($shmId);
var_dump($content);

/* DELETE */
$shmId = shmop_open($key, 'w', 0, 0);
$success = shmop_delete($shmId);
shmop_close($shmId);

function CreateKey($key)
{
        $fileName = './' . $key;
        
        if (!file_exists($fileName))
        {
                touch($fileName);
        }
        
        return FTOK($fileName, 'a');
}

function FTOK($pathName, $projId) 
{
        $stat = stat($pathName);
        
        $key = sprintf("%u", 
                (($stat['ino'] & 0xffff) | (($stat['dev'] & 0xff) << 16) | 
(($projId
& 0xff) << 24)));
        
        return $key;
}
?>

Expected result:
----------------
On a fourth request I would expect an error if I execute the READ part

Actual result:
--------------
I get the foo object.


------------------------------------------------------------------------


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

Reply via email to