Skip to content

[Console] Terminal::hasSttyAvailable() checks availability of exec but then all calls are made via shell_exec #49646

@Gappa

Description

@Gappa

Symfony version(s) affected

6.2.7

Description

Error message:

Terminal:hasSttyAvailable() checks for availability of exec

However, all calls inside the condition are then run using shell_exec and that fails when it is disabled.

One might argue that it does not make much sense to have one function enabled and the other disabled, but apparently it can happen and then it fails.

Or am I missing something? :)

How to reproduce

Have a system, that has:

  • exec enabled
  • shell_exec disabled
  • symfony/console installed
  • symfony/events installed (otherwise checks for dispatcher fail and a different route in the code is taken that will not manifest the problem)

Then try to run the symfony console from command line.

Possible Solution

Either check availability of shell_exec in Terminal::hasSttyAvailable() or change all calls to use exec.

Additional Context

The check has been introduced here:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions