You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 007fa61 / #46971 the logic that checks if TTY is supported changed from checking /dev/tty for reading / writing capabilities directly to checking stream_isatty(\STDOUT).
This causes an issue because the new way fails to take into account the open_basedir restrictions.
open_basedir restriction not in effect, works fine:
php -r "require_once(__DIR__ . '/vendor/autoload.php'); (new \Symfony\Component\Process\Process(['ls', '-lsa']))->setTty(true)->run();"
open_basedir restriction in effect, causes hard crash with PHP Fatal error: Uncaught Symfony\Component\Process\Exception\RuntimeException: Unable to launch a new process. in vendor/symfony/process/Process.php:350:
php -d open_basedir="/path/to/cwd" -r "require_once(__DIR__ . '/vendor/autoload.php'); (new \Symfony\Component\Process\Process(['ls', '-lsa']))->setTty(true)->run();"
Possible Solution
Revert the linked commit or add an additional is_writable('/dev/tty') check.
Additional Context
Side note, can we change the self::isTtySupported() call to static::isTtySupported() instead so that extending classes can override just the relevant method if needed in the future instead of having to override the setTty() method entirely?
The text was updated successfully, but these errors were encountered:
…ss to `/dev/tty` (mjauvin)
This PR was merged into the 6.4 branch.
Discussion
----------
[Process] Return `false` when `open_basedir` prevents access to `/dev/tty`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
If open_basedir restrictions are in effect, checking if the file /dev/tty is writable will prevent setting tty mode on the process, and avoid failing to create a Process.
Fixes#54874
Commits
-------
825e38b Return false in isTtySupported() when open_basedir restrictions prevent access to /dev/tty.
Symfony version(s) affected
>= 6.2
Description
In 007fa61 / #46971 the logic that checks if TTY is supported changed from checking
/dev/tty
for reading / writing capabilities directly to checkingstream_isatty(\STDOUT)
.This causes an issue because the new way fails to take into account the open_basedir restrictions.
Related: wintercms/storm#175
How to reproduce
open_basedir
restriction not in effect, works fine:php -r "require_once(__DIR__ . '/vendor/autoload.php'); (new \Symfony\Component\Process\Process(['ls', '-lsa']))->setTty(true)->run();"
open_basedir
restriction in effect, causes hard crash withPHP Fatal error: Uncaught Symfony\Component\Process\Exception\RuntimeException: Unable to launch a new process. in vendor/symfony/process/Process.php:350
:Possible Solution
Revert the linked commit or add an additional
is_writable('/dev/tty')
check.Additional Context
Side note, can we change the
self::isTtySupported()
call tostatic::isTtySupported()
instead so that extending classes can override just the relevant method if needed in the future instead of having to override thesetTty()
method entirely?The text was updated successfully, but these errors were encountered: