|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59635 APCIterator returns expired items with APC_LIST_ACTIVE
Submitted: 2011-02-23 18:09 UTC Modified: 2016-11-18 21:46 UTC
From: marc-bennewitz at arcor dot de Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: marc-bennewitz at arcor dot de
New email:
PHP Version: OS:


 [2011-02-23 18:09 UTC] marc-bennewitz at arcor dot de
APCIterator returns expired items with APC_LIST_ACTIVE and apc.use_request_time disabled

Reproduce code:
ini_set('apc.use_request_time', 0);

apc_store('key0', 'value0', 100);
apc_store('key1', 'value1', 1);
apc_store('key2', 'value2', 2);


$it = new APCIterator('user', '/key./', APC_ITER_DTIME, 1, APC_LIST_ACTIVE);
var_dump( iterator_to_array($it) );

Expected result:
array(1) {
  array(1) {

Actual result:
array(3) {
  array(1) {
  array(1) {
  array(1) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-24 11:06 UTC]
Interesting, apc only moves stuff off the ACTIVE list when a fetch() happens.

So changing the code to do 

- sleep(2)
+ sleep(3);
+ apc_fetch('key1');
+ apc_fetch('key2');

Would work just fine. But I'll have to fix it to skip expired entries in fetch_active()
 [2016-11-18 21:46 UTC]
-Status: Open +Status: Wont fix
 [2016-11-18 21:46 UTC]
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 09:01:28 2023 UTC