minor #15450 [Console] Handle false return value from readline (michaelperrin)

This PR was merged into the 2.8 branch.

Discussion
----------

[Console] Handle false return value from readline

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Following #15382 and as @stof mentioned, the `false` value can be returned by `readline()` and should be handled. This fixes the problem.

Commits
-------

f5ca270 [Console] Handle false return value from readline
This commit is contained in:
Nicolas Grekas 2015-08-05 09:21:02 +02:00
commit 6c0dc5c865
1 changed files with 3 additions and 3 deletions

View File

@ -434,10 +434,10 @@ class QuestionHelper extends Helper
$ret = readline();
} else {
$ret = fgets($stream, 4096);
}
if (false === $ret) {
throw new \RuntimeException('Aborted');
}
if (false === $ret) {
throw new \RuntimeException('Aborted');
}
return trim($ret);