summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-05-05 09:31:17 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-05-05 11:38:29 +0200
commitf33cf52faf733f5a6441a533f83e9b1cf2018245 (patch)
tree1e95600ddf3429a25ca8a6b7feea59f9f255c557 /ext
parentc40a494406aa3606be964b24d224ec4eb0c936e8 (diff)
downloadphp-git-f33cf52faf733f5a6441a533f83e9b1cf2018245.tar.gz
Fix #79566: Private SHM is not private on Windows
We map the POSIX semantics of `IPC_PRIVATE` by creating unnamed file mapping objects on Windows. While that is not particularly useful for ext/shmop, which is the only bundled extension which uses `shmget()`, it may be useful for external extensions.
Diffstat (limited to 'ext')
-rw-r--r--ext/shmop/tests/shmop_open_private.phpt23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/shmop/tests/shmop_open_private.phpt b/ext/shmop/tests/shmop_open_private.phpt
new file mode 100644
index 0000000000..df969885c9
--- /dev/null
+++ b/ext/shmop/tests/shmop_open_private.phpt
@@ -0,0 +1,23 @@
+--TEST--
+shmop_open with IPC_PRIVATE creates private SHM
+--SKIPIF--
+<?php
+if (!extension_loaded('shmop')) die('skip shmop extension not available');
+?>
+--FILE--
+<?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);
+?>
+--EXPECT--
+bool(true)