php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71955 shmop_open: creating infinite amount of segments
Submitted: 2016-04-04 09:10 UTC Modified: 2016-04-04 11:24 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: kakkau at grr dot la Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 - 15 = ?
Subscribe to this entry?

 
 [2016-04-04 09:10 UTC] kakkau at grr dot la
Description:
------------
1. Run shmop_open with $key=0 and $flags="n" multiple times.
2. Wonder about a missing warning when using the same key for creation.
3. Check the output of ipcs -m. There should show up multiple segments now.

For other integers <> 0 shmop_open works as expected

Test script:
---------------
<?php

$res = shmop_open(0,"n",0600,1024);
$res = shmop_open(0,"n",0600,1024);

?>

Expected result:
----------------
At least a warning should be thrown w/o creating another segment.

Warning: shmop_open(): unable to attach or create shared memory segment in php shell code on line 1

Call Stack:
   10.9282     120780   1. {main}() php shell code:0
   10.9282     120920   2. shmop_open() php shell code:1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-04 09:17 UTC] requinix@php.net
-Package: PHP Language Specification +Package: Unknown/Other Function
 [2016-04-04 11:24 UTC] kakkau at grr dot la
For segments that were opened via $key=0 it is additionally not possible to attach to them.

This snippet
<?php
shmop_open(0,"n",0600,1024);
shmop_open(0,"a",0600,1024);
?>

additionally fails with
Warning: shmop_open(): unable to attach or create shared memory segment in php shell code on line 1
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 10:01:24 2019 UTC