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 key length-validation results in PCRE compilation error #158

Merged
merged 2 commits into from
Aug 6, 2021

Conversation

boesing
Copy link
Member

@boesing boesing commented Aug 6, 2021

Q A
Bugfix yes
BC Break kinda

Description

With 2.12.0, we introduced a better key length handling for the PSR-16 decorator. It initially only supported 64 characters which was the minimum which PSR-16 requires to be supported by implementing cache backends.
The redis adapter can take keys up to 512 MB and thus, this was changed in that adapter.

When allowing key length >65534, PCRE2 will end up in a compilation error. To avoid this, we are decreasing the maximum supported key length for PSR-16 caches to 65534. Technically, this would be a BC break but given the fact, that cache adapters which state to support longer keys would lead to errors while validating the cache keys, we should be fine.

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
To avoid having PCRE compilation error regarding `number too big`, we have to limit the maximum key length of the decorator. This will allow us to keep the performance benefits of `preg_match` while still allowing more than the initial 64 characters limit.

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
@boesing boesing added the Bug Something isn't working label Aug 6, 2021
@boesing boesing added this to the 2.12.2 milestone Aug 6, 2021
@boesing boesing linked an issue Aug 6, 2021 that may be closed by this pull request
@boesing boesing merged commit 36f5cef into laminas:2.12.x Aug 6, 2021
@boesing boesing deleted the bugfix/cache-key-validation branch August 6, 2021 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regular Expression to validate key length leads to compilation error
1 participant