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

Avoid JSON errors with interval > 27263 #6

Closed
wants to merge 1 commit into from

Conversation

mbrodala
Copy link
Contributor

@mbrodala mbrodala commented Dec 6, 2023

Long story short: JSON encoding a serialized PHP object can fail due to invalid UTF-8 characters.

Avoid this by serializing the whole storage entry instead. This basically leads to double-serialization of the limiter state but this is actually no problem.

Technically we'd also need an upgrade wizard or similar to migrate existing JSON-based entries but this is beyond my time.

Fixes #5

Long story short: JSON encoding a serialized PHP object can fail due to
invalid UTF-8 characters.

Avoid this by serializing the whole storage entry instead. This
basically leads to double-serialization of the limiter state but this is
actually no problem.
@brotkrueml
Copy link
Owner

@mbrodala Thanks for the bug report and the pull request. I'll have a look in the next days.

@brotkrueml
Copy link
Owner

Thanks for the investigation. I opted for a json_decode and on error unserialize the value, so no upgrade wizard is necessary (which would also not be expected on a bugfix release). The fallback will then be removed with version 2.0.0.

@brotkrueml brotkrueml closed this Dec 8, 2023
@mbrodala
Copy link
Contributor Author

mbrodala commented Dec 11, 2023

Thanks for the adjustment and merge in 435d9c3

@mbrodala mbrodala deleted the file-storage-sans-json branch December 11, 2023 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use interval > 27263 seconds
2 participants