Page MenuHomePhabricator

apc.enable_cli should be enabled in PHP jobs
Closed, DeclinedPublic


This INI setting allows to use APCU cache in CLI, and having it disabled makes APCU not work for e.g. PHPUnit tests.
See for instance, which consistently fails PHP jobs but not HHVM. It took me a lot to figure out what was wrong, mostly because APCUBagOStuff returns a meaningless value ( Then, via a simple var_dump( ini_get( 'apc.enable_cli' ) ); I understood that in fact caching is disabled.

Event Timeline

Daimona created this task.Apr 14 2019, 5:34 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 14 2019, 5:34 PM

IIRC apc has a history of causing weird bugs in CI with stuff not being invalidated properly. I don't know of those bugs still exist, but if you want a persistent cache to test with, you should use HashBagOStuff.

Maybe it has to do with the comment on top of the APCUBagOStuff file, mentioning bugs when serialization is set to default?

hashar closed this task as Declined.Apr 15 2019, 1:42 PM
hashar added a subscriber: hashar.

In an extension test, I don't think there is any point in testing APCU. The integration testing should be done in MediaWiki core if ever done which would guanratee to the extension that APCU works as a proper BagOStuff . You are much better just using the dummy HashBagOStuff which has the same interface (BagOStuff) and should behave the same :]

That being said, some BagOStuff classes in mediawiki/core have a set function which always return true. But that would be the subject of another task :]

@hashar That's fair, but how can we test that caching works for that bit of code, if the code is using APC to run tests? At this point, shouldn't the service be changed to return a HashBagOStuff instead of APCUBagOStuff during unit tests?