php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48529 Better shm_-functions
Submitted: 2009-06-11 12:24 UTC Modified: 2018-06-18 23:51 UTC
From: ilovekernelpanic at yahoo dot de Assigned:
Status: Not a bug Package: Semaphore related
PHP Version: 5.2.9 OS: Unix
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 !
Your email address:
MUST BE VALID
Solve the problem:
50 - 49 = ?
Subscribe to this entry?

 
 [2009-06-11 12:24 UTC] ilovekernelpanic at yahoo dot de
Description:
------------
shm provides more speed than files or databases. But there is no
proper way to check if a field exists. You can do
@shm_get_var($connection, $field) !== false to check it. But:
-With custom error handlers you will get a warning, when there is no
such $field
-It needs a lot of time to process the warning, but it should be fast

There should be a function shm_has_var or shm_var_exists.

A function shm_export_vars could convert the shared memory to an
associative array.
A function shm_export_keys: Like
array_keys(shm_export_vars($connection)) but faster
Those functions are very essential. When you don't have them you have
to use the shared-memory as a linked list.
A function shm_get_size: Return the size of the shared memory
segment. Not necessary, because you can store it using
shm_put_var($connection, 0, $size), but such a function would be more
secure
Maybe also shm_resize could be possible.

With this function there could be better object oriented array like
wrappers form shared memory.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-23 21:10 UTC] jani@php.net
-Package: Feature/Change Request +Package: Semaphore related
 [2018-06-18 23:51 UTC] stas@php.net
-Status: Open +Status: Not a bug
 [2018-06-18 23:51 UTC] stas@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

https://secure.php.net/manual/en/function.shm-has-var.php exists since 5.3.0
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 21 15:03:34 2021 UTC