-
Notifications
You must be signed in to change notification settings - Fork 178
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
sfValidatorDate throws sfValidatorError with array as $value and therefore not usable in the message #317
Comments
I think PR does not solve the problem, but bypasses the API of sfValidatorError. If you look at how the tests use sfValidatorError you will see that it uses the keys of the array passed in argument 3 when creating the message, in the form %key%. The problem here is that the value is an array that you cannot correctly use in the message. We need to find another solution to solve the problem. |
The PR would give the option to use %year% %month% and %day% in the message but not %value%. $clean = sprintf(
'%04d-%02d-%02d %02d:%02d:%02d',
(int) $value['year'],
(int) $value['month'],
(int) $value['day'],
0,
0,
0
); without validating the values first 😕 |
My idea is create a new option for the date validator: |
One possible solution: |
Yes, let's go this way. I suggest being more strict. As, the value will be displayed to end-users.
Hum, what is the end-user interface that use this validator ? |
When using the Date Validator and providing a Date
2024-11-31
(only 30 Days in November), the Validator correctly throws asfValidatorError
but with the value as array. This happens multiple times in that file...The exact position it happend is inside the
convertDateArrayToString
function where the value is an array but not yet converted to a string.When trying to use %value% in the error message it won't be replaced, because
getArguments
of the class correctly checks for an array and returns nothing in the end. Therefore nothing of the error message will be replaced.The text was updated successfully, but these errors were encountered: