SimpleSHM is a simple and small abstraction layer for shared memory manipulation using PHP. It makes use of the SHMOP functions, built into most PHP packages.
BSD 3-Clause "New" or "Revised" License
136
stars
46
forks
source link
PHP Warning: shmop_close(): no shared memory segment with an id of [0] #7
When I used simpleshm, I encountered a problem with prompt "PHP Warning: shmop_close(): no shared memory segment with an id of [0] ......... ".
In my scenario, I just newed a simpleshm and checked whether Id exists. If the id doesn't exists, I will return from the function. Then it comes above problem.
I think the existing implementation needs to be enhanced to avoid this problem. After reviewed the code, one suggestion to use a flag to indicate whether $this->shmid has been set (i.e, in the write function and in construct function, and check this flag in destruct function).
When I used simpleshm, I encountered a problem with prompt "PHP Warning: shmop_close(): no shared memory segment with an id of [0] ......... ".
In my scenario, I just newed a simpleshm and checked whether Id exists. If the id doesn't exists, I will return from the function. Then it comes above problem.
I think the existing implementation needs to be enhanced to avoid this problem. After reviewed the code, one suggestion to use a flag to indicate whether $this->shmid has been set (i.e, in the write function and in construct function, and check this flag in destruct function).