Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Console Prompt Literal String #2587

Closed
zfbot opened this Issue · 2 comments

3 participants

@zfbot
Owner

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
Owner

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

@diemuzi

Please close, not an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.