symfony1 icon indicating copy to clipboard operation
symfony1 copied to clipboard

Fix APC tests and add APCu support

Open mentalstring opened this issue 3 years ago • 0 comments

This replaces #263.

The APC support has been broken for a while now (see here and here) but since sfAPCCacheTest is often skipped, it's been overlooked.

The issue is that APC has been dropped in more recent versions of PHP and the user cache part of it is now provided by APCu. While there was a compatibility layer it doesn't seem to be maintained anymore, so the functions now have different names (eg: apc_get() to apcu_get(). These days, according to the PHP version use, one needs to use either APC or APCu. In other words, sfAPCCache, as is, no longer works in recent versions of PHP where only APCu is available.

This PR fixes some APC/APCu inconsistencies when using negative TTLs in the tests, and also adds a new sfAPCuCache that is a drop-in replacement for sfAPCCache. It's pretty minor changes from sfAPCCache, and while it is duplicated code, I think it's one of cleanest ways to address this without overcomplicating things. sfAPCCacheTest loads the right one according to which extension is present (apc vs apcu).

Lastly, not sure if we should now drop the line bellow allow travis.yml to run the tests with APC (&APCu) again.

https://github.com/FriendsOfSymfony1/symfony1/blob/6f521e9ef9e800c655313a5f21ac3f55552fbcf4/.travis.yml#L36

mentalstring avatar Aug 03 '22 15:08 mentalstring