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
Zend Server and APC functionality #94
Comments
I don't think we ever call |
|
I was able to resolve the issue by patching as described: https://github.com/kategray/polyfill/commit/e4d9188d6e68835625328c4785529b72b039ba11 |
|
hmm, we could indeed handle this case in your APCu polyfill. It would fix things for people using the APCu polyfill. @nicolas-grekas should be handle this internally in the polyfill, or should we just skip the polyfill if we detect that the |
It looks like createSystemCache() in Symfony/Component/Cache/Adapter/AbstractAdapter.php is checking if APCU is supported. The actual check is
|
@stof I believe you can detect if it's the genuine APC by doing a version check like so:
|
@kategray currently, it reports it as supported, yes, as our polyfill-apcu package accepts polyfilling APCu on top of the Zend Server APC polyfill. APCuAdapter only cares about APCu, and Zend Server does not mess with it. So this is not the place to add support for the APC messed polyfill. |
@stof I agree - that's why I made the changes on my fork in the polyfill-apcu level. If you and @nicolas-grekas would like me to do a pull request for the patch in my fork (the one that converts arrays to individual calls, maintaining compatibility with apc's error handling for the array syntax), I'd be glad to do so. If not, I'll go ahead and delete my fork. |
We should handle that in the APCu polyfill yes. |
So, have separate functions for zend's APC emulation, and select which one in the bootstrap? |
Yep |
Would you like me to do that? |
Please :) I'm almost AFK for two weeks on my side. |
I ended up adding a second bootstrap.php, just for zend. It was cleaner than having two sets of functions in the same bootstrap file. I added a couple of unit tests - they pass on PHP 5.4 with APC. Unfortunately, Zend Cache flat-out refuses to work in the CLI, so I just disable the compatibility when running from the CLI. |
…Server's Data Cache (kategray) This PR was merged into the 1.5-dev branch. Discussion ---------- Fix apcu function when apc ones are polyfilled with Zend Server's Data Cache Fixes #94 Detect if Zend Server's Data Cache is enabled, and work around it's lack of support for the array syntax. Commits ------- a283ded Fix apcu function when apc ones are polyfilled with Zend Server's Data Cache
Zend Server tries to implement compatibility with apc by registering compatibility functions with the same name as the APC functions.
http://files.zend.com/help/Zend-Server-6/content/zend_data_cache_-_configuration_directives.htm
Specifically, the option is "zend_datacache.apc_compatibility". It looks like it gets aliased to zend_shm_cache_store, which mostly works. Unfortunately, it doesn't support the array form of apc_store(), so every call results in errors:
"apc_store() expects parameter 1 to be string, array given"
It looks like this is a problem that other projects have dealt with, and it looks like it's one that's been going on for 8 years or so, so I'm not expecting Zend to fix it anytime soon.
My inclination would be to add a check to see if the parameter to apcu_add() or apcu_store() is an array, and if so to call the apc function individually for each item in the array. It would maintain compatibility with APC, and fix the issues with Zend Server. It's a little bit of a hack, though, and I figured I'd ask before submitting a PR.
Alternatively, I could add support for Zend Data Cache to the Symfony Cache Component.
The text was updated successfully, but these errors were encountered: