Skip to content

Commit

Permalink
[Console] Fixed symfony#29835: ConfirmationQuestion with default true…
Browse files Browse the repository at this point in the history
… for answer '0'

When using the ConfirmationQuestion class to ask a yes / no question,
if the default is true, and the answer regex is '/^y/i', then any
value not starting with [yY] is considered false.
This must include "0"
  • Loading branch information
mrthehud committed Jan 11, 2019
1 parent 4253801 commit ca6690a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -53,7 +53,7 @@ private function getDefaultNormalizer()
return $answer && $answerIsTrue;
}

return !$answer || $answerIsTrue;
return '' === $answer || $answerIsTrue;
};
}
}
Expand Up @@ -41,7 +41,7 @@ public function normalizerUsecases()
],
[
true,
['n', 'N', 'no', 'NO', 'nO', 'foo', '1'],
['n', 'N', 'no', 'NO', 'nO', 'foo', '1', '0'],
false,
'When default is true, the normalizer must return false for "%s"',
],
Expand Down

0 comments on commit ca6690a

Please sign in to comment.