brotkrueml / typo3-form-rate-limit

TYPO3 form finisher for rate limiting when sending a form
https://extensions.typo3.org/extension/form_rate_limit
GNU General Public License v2.0
8 stars 3 forks source link

Avoid JSON errors with interval > 27263 #6

Closed mbrodala closed 11 months ago

mbrodala commented 11 months ago

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

brotkrueml commented 11 months ago

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

brotkrueml commented 11 months ago

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.

mbrodala commented 11 months ago

Thanks for the adjustment and merge in https://github.com/brotkrueml/typo3-form-rate-limit/commit/435d9c3da07d4ffd08a0433f062c85e4b9acc216