Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Console Prompt Literal String #2587

Closed
zfbot opened this Issue Sep 28, 2012 · 2 comments

Comments

Projects
None yet
3 participants

zfbot commented Sep 28, 2012

Jira Information

Original Issue:ZF2-561
Issue Type:Improvement
Reporter:diemuzi
Created:09/14/12
Assignee:weierophinney
Components:Zend\Console

Description

By using the example below I would have expected to be presented with the prompt (does happen) and then I would need to actually type "yes" to continue. Instead, as soon as you key in Y it confirms.

Testing further it appears the prompt only looks for the first character of the defined Char to be entered, if matched then it does what it needs to.

To avoid someone reaching this prompt by accident and keying in Y for Yes, I'd rather be on the safe side and make certain they actually typed Yes.

$confirm = new \Zend\Console\Prompt\Confirm();
$confirm->setPromptText('Are you sure you want to continue?');
$confirm->setYesChar('yes');
$confirm->setNoChar('no');

$result = $confirm->show();

if ($result) {
echo 'Confirmed';
}

zfbot commented Sep 28, 2012

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-561

Known GitHub users mentioned in the original message or comment:
@diemuzi, @weierophinney

Contributor

diemuzi commented Sep 28, 2012

Please close, not an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment