|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78171 Add a prefix to Apc/u
Submitted: 2019-06-15 02:21 UTC Modified: -
Avg. Score:4.6 ± 0.8
Reproduced:8 of 8 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: valentiny510 at gmail dot com Assigned:
Status: Open Package: APC (PECL)
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: valentiny510 at gmail dot com
New email:
PHP Version: OS:


 [2019-06-15 02:21 UTC] valentiny510 at gmail dot com
Apc/u is (obviously) a good and fast way of sharing data between aplications
(as intended), but sometimes you may need NOT to do it, at least not
in the 'normal way'...

I often manage several websites in a dev enviroment, and the 'worst'
thing one could do is to store sensible data like sessions, user data,
etc... (without a Prefix) to avoid extra connections to the database...

apc_store('user_{id}', [session_data => ..., etc => ...])

Then all the dev websites will share the exact same info/data for the user_{id}
Of course I have a wrapper class that prefix everything but I think will be very
very usefull to have it implemented in the core and because C is faster...
A simple function that set the prefix for the session, for instance...

apcu_prefix(string $prefix = null)

And calling the function without argument can return the current prefix
or maybe just reset it to default...

Can also be a very important feature from a security POV since I have seen
some very bad configured shared hosts having this problem, and one could
read the info that other hosts had stored...

The prefix can also act like a password... for functions like apcu_cache_info
Only if you know the prefix/password you will be able to get the info

Thank you


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Aug 09 09:01:24 2020 UTC