diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 423cdecdbe..df65f5ff4b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -66,7 +66,7 @@ jobs: php-version: "${{ matrix.php-version }}" extensions: "apcu, pdo, ${{ matrix.extension }}" coverage: "pcov" - ini-values: "zend.assertions=1" + ini-values: "zend.assertions=1, apc.enable_cli=1" - name: "Require specific DBAL version" run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update" @@ -139,7 +139,7 @@ jobs: with: php-version: "${{ matrix.php-version }}" coverage: "pcov" - ini-values: "zend.assertions=1" + ini-values: "zend.assertions=1, apc.enable_cli=1" - name: "Require specific DBAL version" run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update" @@ -211,7 +211,7 @@ jobs: with: php-version: "${{ matrix.php-version }}" coverage: "pcov" - ini-values: "zend.assertions=1" + ini-values: "zend.assertions=1, apc.enable_cli=1" extensions: "${{ matrix.extension }}" - name: "Install dependencies with Composer" @@ -276,7 +276,7 @@ jobs: with: php-version: "${{ matrix.php-version }}" coverage: "pcov" - ini-values: "zend.assertions=1" + ini-values: "zend.assertions=1, apc.enable_cli=1" extensions: "${{ matrix.extension }}" - name: "Require specific DBAL version" @@ -327,7 +327,7 @@ jobs: uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" - ini-values: "zend.assertions=1" + ini-values: "zend.assertions=1, apc.enable_cli=1" - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v2" diff --git a/.github/workflows/phpbench.yml b/.github/workflows/phpbench.yml index c22e1c778f..5fcc3f53ed 100644 --- a/.github/workflows/phpbench.yml +++ b/.github/workflows/phpbench.yml @@ -45,7 +45,7 @@ jobs: with: php-version: "${{ matrix.php-version }}" coverage: "pcov" - ini-values: "zend.assertions=1" + ini-values: "zend.assertions=1, apc.enable_cli=1" - name: "Cache dependencies installed with composer" uses: "actions/cache@v3" diff --git a/lib/Doctrine/ORM/ORMSetup.php b/lib/Doctrine/ORM/ORMSetup.php index 3213431d73..5a561c90e1 100644 --- a/lib/Doctrine/ORM/ORMSetup.php +++ b/lib/Doctrine/ORM/ORMSetup.php @@ -20,6 +20,7 @@ use Symfony\Component\Cache\Adapter\MemcachedAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; +use function apcu_enabled; use function class_exists; use function extension_loaded; use function md5; @@ -181,7 +182,7 @@ private static function createCacheInstance( $namespace = 'dc2_' . md5($proxyDir); - if (extension_loaded('apcu')) { + if (extension_loaded('apcu') && apcu_enabled()) { return new ApcuAdapter($namespace); } diff --git a/lib/Doctrine/ORM/Tools/Setup.php b/lib/Doctrine/ORM/Tools/Setup.php index 51930d95ee..f07053f719 100644 --- a/lib/Doctrine/ORM/Tools/Setup.php +++ b/lib/Doctrine/ORM/Tools/Setup.php @@ -27,6 +27,7 @@ use Symfony\Component\Cache\Adapter\MemcachedAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; +use function apcu_enabled; use function class_exists; use function dirname; use function extension_loaded; @@ -236,7 +237,7 @@ private static function createCacheInstance(bool $isDevMode, ?Cache $cache): Cac if ($isDevMode === true) { $cache = class_exists(ArrayCache::class) ? new ArrayCache() : new ArrayAdapter(); - } elseif (extension_loaded('apcu')) { + } elseif (extension_loaded('apcu') && apcu_enabled()) { $cache = class_exists(ApcuCache::class) ? new ApcuCache() : new ApcuAdapter(); } elseif (extension_loaded('memcached') && (class_exists(MemcachedCache::class) || MemcachedAdapter::isSupported())) { $memcached = new Memcached();