|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75146 APCu: apcu should not return stale data in cli mode
Submitted: 2017-09-01 14:28 UTC Modified: 2018-02-27 11:38 UTC
From: spam2 at rhsoft dot net Assigned:
Status: Feedback Package: APC (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-09-01 14:28 UTC] spam2 at rhsoft dot net
"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;
 $cache_read = apcu_fetch('shm_ttl_test');
 $cache_read = apcu_fetch('shm_ttl_test');
  trigger_error("unexpected shm-read - value should have expired $cache_read");
  $return_value = 0;


Add a Patch

Pull Requests

Add a Pull Request


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
 [2017-10-24 08:51 UTC]
-Summary: apcu should not return stale data in cli mode +Summary: APCu: apcu should not return stale data in cli mode
 [2018-02-27 11:38 UTC]
-Status: Open +Status: Feedback
 [2018-02-27 11:38 UTC]
Did you set apc.use_request_time=0?
 [2018-02-27 12:45 UTC] spam2 at rhsoft dot net
> Did you set apc.use_request_time=0

no - but "Use the SAPI request start time for TTL" should not matter when apcu_store() set a explicit TTL

the snippet from the report is part of a large cli-autotest-suite which should not behave that way depending on a ini-setting you probably have no control of
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC