Statamic saves form submissions into random numbered strings which get separated by a dot like site/storage/forms/contact/1565124392.8228.yaml.
In my case (statamic v2.11.12) on german localization (de.UTF-8) the dot gets replaced by a comma which results in an error if statamic tries to fetch the submissions to display them in the backend (site/storage/forms/contact/1565124392,8228.yaml).
I guess the reason for this behavior is that in germany decimals get separated by commas and not by dots like in the english language.
I digged a little deeper in the statamic codebase and found the issue:
In file statamic/core/Forms/Submission.php at line 45 statamic uses the php-function microtime(true) enabling float numbers. That leads to different outputs depending on the localization of the current install.
A possible fix could be to just don't use floating numbers or to replace possible commas with a str_replace into dots.
EDIT: My hotfix was to replace the microtime commas with dots using: str_replace(',', '.', microtime(true)) since the pure microtime() returned s string including spaces.
To Reproduce
Steps to reproduce the behavior:
Install statamic
Make sure you have an other language on your OS installed than english (in my example de_DE.UTF-8)
Set the default language to that language in you `system.yaml'
Set up example forms and hit submit
Look at filenames of submitted Form 👀
Expected behavior
Filenames should not containt any characters other than numbers and dots.
Environment details (please complete the following information):
Describe the bug Related to: https://statamic.com/forum/3759-comma-in-filename-of-form-submission-after-switching-to-dutch-locale
Statamic saves form submissions into random numbered strings which get separated by a dot like
site/storage/forms/contact/1565124392.8228.yaml
. In my case (statamic v2.11.12) on german localization (de.UTF-8) the dot gets replaced by a comma which results in an error if statamic tries to fetch the submissions to display them in the backend (site/storage/forms/contact/1565124392,
8228.yaml). I guess the reason for this behavior is that in germany decimals get separated by commas and not by dots like in the english language.I digged a little deeper in the statamic codebase and found the issue: In file
statamic/core/Forms/Submission.php
at line 45 statamic uses the php-functionmicrotime(true)
enabling float numbers. That leads to different outputs depending on the localization of the current install.A possible fix could be to just don't use floating numbers or to replace possible commas with a
str_replace
into dots.EDIT: My hotfix was to replace the microtime commas with dots using:
str_replace(',', '.', microtime(true))
since the puremicrotime()
returned s string including spaces.To Reproduce Steps to reproduce the behavior:
Expected behavior Filenames should not containt any characters other than numbers and dots.
Environment details (please complete the following information):