Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 586b9d5

Browse files
[ClassLoader] Use symfony/polyfill-apcu
1 parent 707d359 commit 586b9d5

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ before_install:
3838
- echo session.gc_probability = 0 >> $INI_FILE
3939
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
4040
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
41-
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
42-
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
41+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
42+
- if [[ $TRAVIS_PHP_VERSION = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
43+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0; fi;
4344
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
4445
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
4546
- if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": ">=5.3.3",
2020
"doctrine/common": "~2.4",
21+
"symfony/polyfill-apcu": "~1.0,>=1.0.2",
2122
"twig/twig": "~1.23|~2.0",
2223
"psr/log": "~1.0"
2324
},

src/Symfony/Component/ClassLoader/ApcClassLoader.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ApcClassLoader
6767
*/
6868
public function __construct($prefix, $decorated)
6969
{
70-
if (!extension_loaded('apc')) {
70+
if (!ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) {
7171
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
7272
}
7373

@@ -122,8 +122,8 @@ public function loadClass($class)
122122
*/
123123
public function findFile($class)
124124
{
125-
if (false === $file = apc_fetch($this->prefix.$class)) {
126-
apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
125+
if (false === $file = apcu_fetch($this->prefix.$class)) {
126+
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
127127
}
128128

129129
return $file;

src/Symfony/Component/ClassLoader/composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"minimum-stability": "dev",
1919
"require": {
20-
"php": ">=5.3.3"
20+
"php": ">=5.3.3",
21+
"symfony/polyfill-apcu": "~1.0,>=1.0.2"
2122
},
2223
"require-dev": {
2324
"symfony/finder": "~2.0,>=2.0.5"

0 commit comments

Comments
 (0)