Skip to content
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

Apcu cache is used even if it is not enabled #10310

Closed
aleksejs1 opened this issue Dec 15, 2022 · 2 comments
Closed

Apcu cache is used even if it is not enabled #10310

aleksejs1 opened this issue Dec 15, 2022 · 2 comments
Labels

Comments

@aleksejs1
Copy link
Contributor

Bug Report

Q A
BC Break no
Version 2.13.x

Summary

In case of apcu extension exists, but not enabled Doctrine/ORM/Tools::createCacheInstance still creates ApcuCache or ApcuAdapter.
When someone try to write the cache "Failed to save key xxx of type Doctrine\ORM\Mapping\ClassMetadata." error appears.

Current behavior

When someone try to write the cache "Failed to save key xxx of type Doctrine\ORM\Mapping\ClassMetadata." error appears.

How to reproduce

Just an example:
Make the environment with existed disabled apcu extension.
Create doctrine migration with entityManager dependency.
Run doctrine:migration:status in cli.
Got "Failed to save key xxx of type Doctrine\ORM\Mapping\ClassMetadata." error.

Solution options

Change if statement in https://github.com/doctrine/orm/blob/2.13.x/lib/Doctrine/ORM/Tools/Setup.php#L239
from } elseif (extension_loaded('apcu')) {
to } elseif (extension_loaded('apcu') && apcu_enabled()) {
or } elseif (extension_loaded('apcu') && ini_get('apc.enabled')) {

@derrabus
Copy link
Member

The proposed solution looks good to me, PR welcome.

@derrabus derrabus added the Bug label Dec 15, 2022
aleksejs1 pushed a commit to aleksejs1/orm that referenced this issue Dec 15, 2022
aleksejs1 pushed a commit to aleksejs1/orm that referenced this issue Dec 15, 2022
aleksejs1 pushed a commit to aleksejs1/orm that referenced this issue Dec 15, 2022
derrabus pushed a commit that referenced this issue Dec 18, 2022
* add apcu enabled check if apcu extension loaded (#10310)

* Apply suggestions from code review

Co-authored-by: Grégoire Paris <[email protected]>

* add use function apcu_enabled

* enable apcu_cli for cache tests

Co-authored-by: Aleksejs Kovalovs <[email protected]>
Co-authored-by: Grégoire Paris <[email protected]>
derrabus added a commit that referenced this issue Dec 18, 2022
* 2.13.x:
  add apcu enabled check if apcu extension loaded (#10310) (#10311)
derrabus added a commit to derrabus/orm that referenced this issue Dec 19, 2022
* 2.14.x:
  Drop forceful loading of annotations (doctrine#10321)
  Document stdClass structures used by CommitOrderCalculator (doctrine#10315)
  Psalm 5.3.0 (doctrine#10317)
  PHPStan 1.9.4 (doctrine#10318)
  add apcu enabled check if apcu extension loaded (doctrine#10310) (doctrine#10311)
  Add TypedFieldMapper for automatic mapping of typed PHP fields to DBAL types (doctrine#10313)
derrabus added a commit to derrabus/orm that referenced this issue Dec 19, 2022
* 2.14.x:
  Drop forceful loading of annotations (doctrine#10321)
  Document stdClass structures used by CommitOrderCalculator (doctrine#10315)
  Psalm 5.3.0 (doctrine#10317)
  PHPStan 1.9.4 (doctrine#10318)
  add apcu enabled check if apcu extension loaded (doctrine#10310) (doctrine#10311)
  Add TypedFieldMapper for automatic mapping of typed PHP fields to DBAL types (doctrine#10313)
@mpdude
Copy link
Contributor

mpdude commented Jan 26, 2023

Fixed by #10311, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants