symfony/symfony — pull request #7674 by Tatsh (2013-04-15 04:03:45+00:00)
Title: Add support for detection of Zend OPcache as an accelerator

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |

Related: https://github.com/symfony/symfony/pull/7670

**From original pull request:**

More information: https://github.com/zend-dev/ZendOptimizerPlus

This extension is compatible with PHP 5.2-5.5. I'm using it with 5.5 and 5.4. The PHP developers plan to include this as opposed to APC in PHP 5.5 core. http://php.net/archive/2013.php#id2013-03-21-1

This does not really have to do with Zend Optimiser+. It has to do with the newly open sourced version, Zend OPcache.

I noticed a *similar* PR here https://github.com/symfony/symfony/pull/7087 but did not like that the unit test check for accelerators was completely removed. I also do not consider it necessary to add more code just for an extension check (I would consider that 'unnecessary re-factoring'). And finally, I have no idea what the final purpose of it is. Based on its title, it seemed like at first that it was for Zend Optimizer+ (the proprietary extension: http://files.zend.com/help/Zend-Server-6/zend-server.htm#zendoptimizerplus.html) but then it sort of changed to adding support for Zend OPcache (the recently open sourced version).

This does only Zend OPcache. Tested on PHP 5.5 and PHP 5.4, including unit tests.

Based on naming scheme, I decided to name the function `hasZendOpcache` (ignoring the abbreviation as with `hasApc`) as opposed to `hasZendOpCache` or other names. Not sure if this is the 'perfect name' (it gets called in all lower-case in the twig file anyway).