Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit324b512

Browse files
committed
[Console]Fixed#29835: ConfirmationQuestion with default true 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 anyvalue not starting with [yY] is considered false.This must include "0"
1 parent4ed009b commit324b512

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎src/Symfony/Component/Console/Question/ConfirmationQuestion.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function getDefaultNormalizer()
5353
return$answer &&$answerIsTrue;
5454
}
5555

56-
return!$answer ||$answerIsTrue;
56+
return'' ===$answer ||$answerIsTrue;
5757
};
5858
}
5959
}

‎src/Symfony/Component/Console/Tests/Question/ConfirmationQuestionTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function normalizerUsecases()
4040
],
4141
[
4242
true,
43-
['n','N','no','NO','nO','foo','1'],
43+
['n','N','no','NO','nO','foo','1','0'],
4444
false,
4545
'When default is true, the normalizer must return false for "%s"',
4646
],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp