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

[Cache] Added reserved characters constant for CacheItem #33516

Merged
merged 1 commit into from Sep 11, 2019

Conversation

@andyexeter
Copy link
Contributor

commented Sep 9, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

This PR introduces a RESERVED_CHARACTERS constant to the CacheItem class to keep things DRY.

The rationale for making the constant public is so that developers can access the list of reserved characters so they could - for example - sanitise keys before passing them to the Cache component.

src/Symfony/Component/Cache/CacheItem.php Outdated Show resolved Hide resolved

@andyexeter andyexeter force-pushed the andyexeter:cache_item_reserved_chars branch from 47498dd to 17c210f Sep 9, 2019

@derrabus

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2019

On second thought: Those reserved characters are not implementation-specific, right? Maybe we could add them to the contracts' CacheItemInterface instead?

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

On ItemInterface in contracts, good idea.
Don't miss bumping the minimum version of the cache-contracts to ^1.1.7 for the component.

@andyexeter

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2019

Don't miss bumping the minimum version of the cache-contracts to ^1.1.7 for the component.

@nicolas-grekas Could you confirm you are saying I should change the following:

"symfony/cache-contracts": "^1.1|^2",

To this:

"symfony/cache-contracts": "^1.1.7|^2", 

@andyexeter andyexeter force-pushed the andyexeter:cache_item_reserved_chars branch from 17c210f to 5964497 Sep 10, 2019

@andyexeter

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2019

The constant has been moved to ItemInterface and composer.json has been updated to bump the cache-contracts minimum version.

@fabpot
fabpot approved these changes Sep 11, 2019

@fabpot fabpot force-pushed the andyexeter:cache_item_reserved_chars branch from fea8fd6 to d853306 Sep 11, 2019

@fabpot

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

Thank you @andyexeter.

@fabpot fabpot closed this in 9c3345f Sep 11, 2019

@fabpot fabpot merged commit d853306 into symfony:4.4 Sep 11, 2019

1 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build cancelled
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
fabbot.io Your code looks good.
Details
@yellow1912

This comment has been minimized.

Copy link

commented Sep 14, 2019

I started getting this error today after updating. I wonder if this is related to the new change:

Undefined class constant 'RESERVED_CHARACTERS'

image


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.