Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Switch all exec calls to proc_open #25

Open
rungta opened this issue Nov 5, 2019 · 3 comments
Open

[FR]: Switch all exec calls to proc_open #25

rungta opened this issue Nov 5, 2019 · 3 comments
Assignees

Comments

@rungta
Copy link

rungta commented Nov 5, 2019

Could the exec calls in the code base be switched to proc_open for wider compatibility with systems where exec is disabled (and better security?)?

@khalwat
Copy link
Contributor

khalwat commented Nov 8, 2019

@rungta I think really what should happen is they should all be switched over to use the ::executeShellCommand() which does exactly that:

    protected function executeShellCommand(string $command): string
    {
        // Create the shell command
        $shellCommand = new ShellCommand();
        $shellCommand->setCommand($command);

        // If we don't have proc_open, maybe we've got exec
        if (!\function_exists('proc_open') && \function_exists('exec')) {
            $shellCommand->useExec = true;
        }

The good news is that there are only 3 places where exec() is used directly, so this shouldn't be bad to do.

@khalwat khalwat self-assigned this Nov 8, 2019
@khalwat khalwat changed the title Refactor request: Switch all exec calls to proc_open [FR]: Switch all exec calls to proc_open Nov 8, 2019
@khalwat
Copy link
Contributor

khalwat commented Nov 9, 2019

I take it back, it's not a simple swap-out because exec() returns an array, and the shellCommand returns a string.

@rungta
Copy link
Author

rungta commented Nov 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants