-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix APC tests and add APCu support #267
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Maybe @alquerci (as you reviewed the original PR) would give a feedback too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
✔️ Tests passes with apcu-5.1.21
🔴 But not with apcu-5.1.22
,
I come back since long time, so I went to run all tests.
I got on PHP 7.0 and lower.
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /app/lib/log/sfLogger.class.php on line 30
It is not a blame, I just expose what I see.
For PHP >7.0 all tests passes, good job ✔️ .
b3fbae5
to
59704bf
Compare
I believe the issue is a not quite planned behaviour change on 5.1.22 that even broke the apc.php info page. This has been reverted on 5.1.23 released a month ago — the test passes again with that. I don't think it's worth putting a complicated workaround for a specific apcu version — maybe we can just skip() if it's
I'm having trouble running the tests from master.
Any idea, @alquerci? |
Hello @mentalstring I agree, for the APCu version. For running tests. Try with patches. |
987bfb6
to
b2af1f7
Compare
I've rebased and added the skip for APCu 5.1.22. Also filled I think it's ready for merging. But if the minimum version becomes PHP 7.0, then I suppose instead of having two classes (
Still can't reproduce this. I have tested |
@mentalstring What steps did you done to execute the whole test suite with PHP 7.0? I suppose
|
Yep, pretty much. The test completed with no problem for me. |
After removing @mentalstring without this following patch, you will get the But this issue is unrelated with this PR, except for the minimum PHP version supported. |
b2af1f7
to
864409c
Compare
Should be ready now. |
864409c
to
0c77ff7
Compare
Thanks @mentalstring !
wdyt? |
0c77ff7
to
2569329
Compare
2569329
to
802c1dd
Compare
Ah, good point. I think I managed to enable APCu on the CI runs, and I checked that it already installs 5.1.23 so that the test doesn't get skipped.
Happy to, just not sure if I covered everything... Was it just the line length? |
Nice! Thanks!
One of the commit's long-message reads
It should read "..which no longer works..." instead (the no is missing) |
- Using negative TTLs to force the immediate expiration of keys, while convenient in tests, doesn't work consistently with APC and is an undocumented feature. Using a low TTL and sleep() is what guarantees that it works for APC. See krakjoe/apcu#184 - The setting apc.use_request_time interferes with key expiration when running on the CLI. Making sure it always has a sensible value for running the tests. See krakjoe/apcu#392
Support for the APCu extension (through sfAPCuCache) as an alternative to APC, which no longer works with recent versions of PHP.
From PHP 7.2 onward, session functions are stricter and may not work if output/headers have already been sent out. Using output buffering prevents this issue.
Replace the use of sfAPCCache with sfFileCache in sfCacheSessionStorageTest so that it doesn't depend on APC being available.
802c1dd
to
058149b
Compare
Merged, thanks @mentalstring ! 🎉 |
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()
toapcu_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.symfony1/.travis.yml
Line 36 in 6f521e9