php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75146 apcu should not return stale data in cli mode
Submitted: 2017-09-01 14:28 UTC Modified: -
From: spam2 at rhsoft dot net Assigned:
Status: Open Package: APC (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID:
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spam2 at rhsoft dot net
New email:
PHP Version: OS:

 

 [2017-09-01 14:28 UTC] spam2 at rhsoft dot net
Description:
------------
"After the ttl has passed, the stored variable will be expunged from the cache (on the next request)" - fine, i don't care when it get purged phyiscally but i care when it lives forever in CLI mode

the code below was intended to run within our cli-autotests but since there are no requests "apc.enable_cli = 1" is completly unuseable in a long running script because you get stale data forever

i guess the check is done against $_SERVER['REQUEST_TIME'] which don't change and is fine in webserver-mode to save expensive time() calls but not in CLI mode

 apcu_store('shm_ttl_test', 'TTL TEST', 1);
 $cache_read = apcu_fetch('shm_ttl_test', $success);
 if($success !== true || $cache_read !== 'TTL TEST')
 {
  trigger_error('unexpected shm-read');
  $return_value = 0;
 }
 sleep(1);
 $cache_read = apcu_fetch('shm_ttl_test');
 $cache_read = apcu_fetch('shm_ttl_test');
 if(!empty($cache_read))
 {
  trigger_error("unexpected shm-read - value should have expired $cache_read");
  $return_value = 0;
 }


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-01 14:30 UTC] spam2 at rhsoft dot net
or at least trigger a warning when TTL is set in CLI mode that this don't work
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC