bug #13683 [PROCESS] make sure /dev/tty is readable (staabm)

This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #13683).

Discussion
----------

[PROCESS] make sure /dev/tty is readable

When using Process from Web-SAPI it is likely that the webserver user
doesn't has rights to use /dev/tty

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

Commits
-------

935afe6 [PROCESS] make sure /dev/tty is readable
This commit is contained in:
Fabien Potencier 2015-02-24 12:07:24 +01:00
commit c475704c8f
1 changed files with 3 additions and 0 deletions

View File

@ -792,6 +792,9 @@ class Process
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
}
if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) {
throw new RuntimeException('TTY mode requires /dev/tty to be readable.');
}
$this->tty = (bool) $tty;