bug #17669 [Console] remove readline support (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[Console] remove readline support

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15583
| License       | MIT
| Doc PR        |

Commits
-------

0e45a4a [Console] remove readline support
This commit is contained in:
Fabien Potencier 2016-02-04 07:59:11 +01:00
commit c8678f4de6
2 changed files with 10 additions and 25 deletions

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
2.8.3
-----
* remove readline support from the question helper as it caused issues
2.8.0
-----

View File

@ -134,7 +134,11 @@ class QuestionHelper extends Helper
}
if (false === $ret) {
$ret = $this->readFromInput($inputStream);
$ret = fgets($inputStream, 4096);
if (false === $ret) {
throw new \RuntimeException('Aborted');
}
$ret = trim($ret);
}
} else {
$ret = trim($this->autocomplete($output, $question, $inputStream));
@ -427,30 +431,6 @@ class QuestionHelper extends Helper
return self::$shell;
}
/**
* Reads user input.
*
* @param resource $stream The input stream
*
* @return string User input
*
* @throws RuntimeException
*/
private function readFromInput($stream)
{
if (STDIN === $stream && function_exists('readline')) {
$ret = readline('');
} else {
$ret = fgets($stream, 4096);
}
if (false === $ret) {
throw new RuntimeException('Aborted');
}
return trim($ret);
}
/**
* Returns whether Stty is available or not.
*