Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #33011 : shmop: can still open segment for reading after shmop_delete
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 21st April 05:32
External User
 
Posts: 1
Default #33011 : shmop: can still open segment for reading after shmop_delete


ID: 33011
Updated by: sniper@php.net
Reported By: joe at bs0 dot com
-Status: Assigned
+Status: Open
Bug Type: Semaphore related
Operating System: win32 only
PHP Version: 5.0.4, 4.3.11
Assigned To: iliaa


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

[2005-05-19 23:33:39] joe at bs0 dot com

patch: http://www.bs0.com/~joe/php/tsrm/tsrm_win32.diff
complete: http://www.bs0.com/~joe/php/tsrm/tsrm_win32.c
changes: http://www.bs0.com/~joe/php/tsrm/changes.txt

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

[2005-05-18 14:29:34] derick@php.net

Put a patch on the web, and provide the URL here please. (And if you
can, provide a summary why it was wrong and how you fixed it).

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

[2005-05-15 02:34:02] joe at bs0 dot com

as short as I can make it:

<?php
$toWrite = 'test string';
$shm_len = strlen($toWrite);

$shm_id = shmop_open(0xff3, "c", 0644, $shm_len);

shmop_write($shm_id, $toWrite, 0);
shmop_close($shm_id);

$shm_id = shmop_open(0xff3, "a", 0, 0);
$data = shmop_read($shm_id, 0, $shm_len);
shmop_close($shm_id);

$shm_id = shmop_open(0xff3, "w", 0, 0);

if (!shmop_delete($shm_id)) {
echo "Couldn't mark shared memory block for deletion.<br/>";
}
else {
echo "shared memory block marked for deletion.<br/>";
}

shmop_close($shm_id);
echo 'block closed.<br/>';

$shm_id = shmop_open(0xff3, "a", 0, 0);

if($shm_id) {
$data = shmop_read($shm_id, 0, $shm_len);
shmop_close($shm_id);

echo 'ERROR: Previously deleted block able to be opened.<br/>';
echo 'Data read : "' . $data . '"';
}
else {
echo 'Could not open previously deleted block.<br/>';
}
?>

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

[2005-05-12 04:33:53] joe at bs0 dot com

Description:
------------
Tested with iis/php5.0.4, iis/php4.3.11, apache2/php4.3.11 - same
problem. after a succesful call to shmop_delete, the shared memory can
still be opened, and the previous values read in. Delete call seems to
have no effect.

Each step is done in new request:
1)Create shared memory block, populate with string.
2)open block, read in string
3)open block, call shmop_delete (returns true)
4)open block, read in string <- should not be able to open block for
reading at this point.


looks to be the same as Bug #28965, this bug has status of No Feedback,
so opening a new one.

Reproduce code:
---------------
Code to reproduce:
http://bs0.com/shmop/shmop_test.php.txt

Expected result:
----------------
leave only one step uncommented at a time, at step 4, the open should
fail and no data should be read in.

Actual result:
--------------
After step 4, memory is still opened/data is read in.


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


--
Edit this bug report at http://bugs.php.net/?id=33011&edit=1
  Reply With Quote


  sponsored links


2 21st April 05:32
External User
 
Posts: 1
Default #33011 : shmop: can still open segment for reading after shmop_delete


ID: 33011
Updated by: sniper@php.net
Reported By: joe at bs0 dot com
-Status: Open
+Status: Assigned
Bug Type: Semaphore related
Operating System: win32 only
PHP Version: 5.0.4, 4.3.11
Assigned To: iliaa
New Comment:

Ilia, have you checked the patch in this report yet?

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

[2005-05-19 23:33:39] joe at bs0 dot com

patch: http://www.bs0.com/~joe/php/tsrm/tsrm_win32.diff
complete: http://www.bs0.com/~joe/php/tsrm/tsrm_win32.c
changes: http://www.bs0.com/~joe/php/tsrm/changes.txt

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

[2005-05-18 14:29:34] derick@php.net

Put a patch on the web, and provide the URL here please. (And if you
can, provide a summary why it was wrong and how you fixed it).

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

[2005-05-15 02:34:02] joe at bs0 dot com

as short as I can make it:

<?php
$toWrite = 'test string';
$shm_len = strlen($toWrite);

$shm_id = shmop_open(0xff3, "c", 0644, $shm_len);

shmop_write($shm_id, $toWrite, 0);
shmop_close($shm_id);

$shm_id = shmop_open(0xff3, "a", 0, 0);
$data = shmop_read($shm_id, 0, $shm_len);
shmop_close($shm_id);

$shm_id = shmop_open(0xff3, "w", 0, 0);

if (!shmop_delete($shm_id)) {
echo "Couldn't mark shared memory block for deletion.<br/>";
}
else {
echo "shared memory block marked for deletion.<br/>";
}

shmop_close($shm_id);
echo 'block closed.<br/>';

$shm_id = shmop_open(0xff3, "a", 0, 0);

if($shm_id) {
$data = shmop_read($shm_id, 0, $shm_len);
shmop_close($shm_id);

echo 'ERROR: Previously deleted block able to be opened.<br/>';
echo 'Data read : "' . $data . '"';
}
else {
echo 'Could not open previously deleted block.<br/>';
}
?>

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

[2005-05-12 04:33:53] joe at bs0 dot com

Description:
------------
Tested with iis/php5.0.4, iis/php4.3.11, apache2/php4.3.11 - same
problem. after a succesful call to shmop_delete, the shared memory can
still be opened, and the previous values read in. Delete call seems to
have no effect.

Each step is done in new request:
1)Create shared memory block, populate with string.
2)open block, read in string
3)open block, call shmop_delete (returns true)
4)open block, read in string <- should not be able to open block for
reading at this point.


looks to be the same as Bug #28965, this bug has status of No Feedback,
so opening a new one.

Reproduce code:
---------------
Code to reproduce:
http://bs0.com/shmop/shmop_test.php.txt

Expected result:
----------------
leave only one step uncommented at a time, at step 4, the open should
fail and no data should be read in.

Actual result:
--------------
After step 4, memory is still opened/data is read in.


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


--
Edit this bug report at http://bugs.php.net/?id=33011&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666