Bug #79566 [PATCH]: Private SHM is not private on Windows
| From: | cmb@php.net | Date: | Tue, 05 May 2020 09:35:25 +0000 |
| Subject: | Bug #79566 [PATCH]: Private SHM is not private on Windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226921@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79566&edit=1
ID: 79566
Patch added by: cmb@php.net
Reported by: cmb@php.net
Summary: Private SHM is not private on Windows
Status: Assigned
Type: Bug
Package: *Extensibility Functions
Operating System: Windows only
PHP Version: 7.3Git-2020-05-05 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Support shmget(IPC_PRIVATE, â¦) on Windows
On GitHub: https://github.com/php/php-src/pull/5519
Patch: https://github.com/php/php-src/pull/5519.patch
Previous Comments:
------------------------------------------------------------------------
[2020-05-05 09:31:21] cmb@php.net
Description:
------------
Calling shmop_open() with a $key that matches IPC_PRIVATE (which
is usually zero on POSIX, and always zero on Windows), creates
private shared memory on POSIX, but not on Windows.
This is actually not particularly related to ext/shmop, but rather
to our Windows emulation layer for XSI shared memory (shmget() and
friends), so all extensions which use that functionality to create
private SHM are affected by this. For instance, APCu[1].
[1] <https://github.com/krakjoe/apcu/issues/394>
Test script:
---------------
<?php
$write = 'test';
$shm1 = shmop_open(0, 'c', 0777, 1024);
shmop_write($shm1, $write, 0);
$shm2 = shmop_open(0, 'c', 0777, 1024);
$read = shmop_read($shm2, 0, 4);
var_dump(is_string($read) && $read !== $write);
shmop_close($shm1);
shmop_close($shm2);
?>
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79566&edit=1