php.net |  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: 2021-06-22 12:26 UTC
Votes:10
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: cmb (profile)
Status: Closed 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: valentiny510 at gmail dot com
New email:
PHP Version: OS:

 

 [2019-06-15 02:21 UTC] valentiny510 at gmail dot com
Description:
------------
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-22 12:26 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-22 12:26 UTC] cmb@php.net
The bug tracker of APCu has been moved to Github[1].  If you're
still interested in this feature, please request it there.

[1] <https://github.com/krakjoe/apcu/issues>
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 20:01:36 2025 UTC