php.net |  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
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: marc-bennewitz at arcor dot de
New email:
PHP Version: OS:

 

 [2011-02-23 18:09 UTC] marc-bennewitz at arcor dot de
Description:
------------
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);

sleep(2);

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

Expected result:
----------------
array(1) {
  ["key0"]=>
  array(1) {
    ["deletion_time"]=>
    int(0)
  }
}

Actual result:
--------------
array(3) {
  ["key0"]=>
  array(1) {
    ["deletion_time"]=>
    int(0)
  }
  ["key1"]=>
  array(1) {
    ["deletion_time"]=>
    int(0)
  }
  ["key2"]=>
  array(1) {
    ["deletion_time"]=>
    int(0)
  }
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-24 11:06 UTC] gopalv@php.net
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] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:46 UTC] kalle@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC