Skip to content

[Cache] Throw exception if incompatible version of psr/simple-cache is used #45096

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

Merged

Conversation

colinodell
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #44738
License MIT
Doc PR n/a

Addresses #44738 by throwing an explanatory exception when an incompatible version of psr/simple-log is used.

Important: This change should not be included in 6.0+, as those newer versions do not have this compatibility issue! This commit should instead be reverted during that merge.

Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should check the return type of a method of the CacheInterface instead.

@colinodell colinodell force-pushed the prevent-installation-of-incompatible-package branch from f725fe7 to 9a72912 Compare January 20, 2022 23:42
@@ -11,6 +11,7 @@

namespace Symfony\Component\Cache;

use Composer\InstalledVersions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use 3.0+ as version number and drop using this class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Fixed and force-pushed :)

@colinodell colinodell changed the title Throw exception if incompatible version of psr/simple-cache is used [Cache] Throw exception if incompatible version of psr/simple-cache is used Jan 21, 2022
@colinodell colinodell force-pushed the prevent-installation-of-incompatible-package branch from 9a72912 to e35ad89 Compare January 21, 2022 13:49
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Can you please confirm that this effectively improves the situation by giving the patch a try on the case you had?

@carsonbot carsonbot changed the title [Cache] Throw exception if incompatible version of psr/simple-cache is used Throw exception if incompatible version of psr/simple-cache is used Jan 21, 2022
@carsonbot carsonbot changed the title Throw exception if incompatible version of psr/simple-cache is used [Cache] Throw exception if incompatible version of psr/simple-cache is used Jan 21, 2022
@colinodell
Copy link
Contributor Author

Can you please confirm that this effectively improves the situation by giving the patch a try on the case you had?

Performing a quick test directly within the component's source directory shows that the exception is indeed only thrown when psr/simple-cache 3.0 is installed:

image

This does not prevent the installation of the conflicting version as I originally hoped (and thus the oddly-named feature branch here), but it at least provides a clear explanation of what's wrong and how to correct it, which is good enough for me and my library's users :)

@fabpot
Copy link
Member

fabpot commented Jan 22, 2022

Thank you @colinodell.

@fabpot fabpot merged commit 8a0ed01 into symfony:4.4 Jan 22, 2022
@fabpot
Copy link
Member

fabpot commented Jan 22, 2022

Code reverted on 6.0+

@colinodell colinodell deleted the prevent-installation-of-incompatible-package branch January 25, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants