Преглед изворни кода

Merge pull request #3502 from acoulton/patch-1

Prevent APC causing random fatal errors [fixes #264]
Jordi Boggiano пре 10 година
родитељ
комит
37ec0bde9d
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      src/Composer/Compiler.php

+ 10 - 0
src/Composer/Compiler.php

@@ -212,6 +212,16 @@ class Compiler
  * the license that is located at the bottom of this file.
  */
 
+// Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
+if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
+    if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
+        ini_set('apc.cache_by_default', 0);
+    } else {
+        fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
+        fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
+    }
+}
+
 Phar::mapPhar('composer.phar');
 
 EOF;