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

Fix construction of sfValidatorError with an array of an array #318

Closed
wants to merge 1 commit into from
Closed

Fix construction of sfValidatorError with an array of an array #318

wants to merge 1 commit into from

Conversation

flohoss
Copy link

@flohoss flohoss commented Jan 19, 2024

So in error messages the use of %year% %month% and %day% becomes possible

Closes #317

@@ -156,7 +156,7 @@ protected function convertDateArrayToString($value)
// all elements must be empty or a number
foreach (array('year', 'month', 'day', 'hour', 'minute', 'second') as $key) {
if (isset($value[$key]) && !ctype_digit((string) $value[$key]) && !empty($value[$key])) {
throw new sfValidatorError($this, 'invalid', array('value' => $value));
throw new sfValidatorError($this, 'invalid', $value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break sfValidatorError::getValue() that depends on value key.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately that's not covered by the tests, as they're green anyway :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's human mutation testing. :)

So in error messages the use of %year% %month% and %day% becomes possible
@flohoss flohoss closed this by deleting the head repository Mar 25, 2024
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.

sfValidatorDate throws sfValidatorError with array as $value and therefore not usable in the message
3 participants