Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Process] Fix backwards compatibility for invalid commands #58189

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

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

ausi
Copy link
Contributor

@ausi ausi commented Sep 5, 2024

Q A
Branch? 7.1
Bug fix? yes
New feature? no
Deprecations? maybe?
Issues Fix #57946
License MIT

As discussed in #57946 (comment)

Comment on lines 361 to 365

// Backwards compatibility. To be removed in version 8.0
if (!\is_resource($process) && \is_array($commandline)) {
$process = @proc_open($this->buildShellCommandline($commandline), $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we trigger a deprecation here like this?

if (\is_resource($process)) {
    trigger_deprecation('symfony/process', '7.1', 'Executing non-existent commands will no longer start the process and instead throw a "%s" exception in 8.0.', ProcessStartFailedException::class);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just document it in the UPGRADE-7.1.md?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's nothing to do IMHO, just revert to the previous behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lose a great deal of performance for cases where proc_open() fails. That’s why I’d prefer to remove this in a future version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lose a great deal of performance for cases where proc_open() fails

Sure but do we have a use case where failures are on the hot path?
If not, things are fine as is. If yes, we should make this opt-in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure. If someone has that use case they could probably make a pull request then.

I’d still like the behavior better that an invalid command throws an exception (like an invalid cwd already does). This would be the better API design I think. But that’s your decision of course :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forward plan looks fine to me. We are tightly bound by BC concerns :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to throw again an exception on invalid command in 8.0, we need to provide an opt-in in 7.x (but not 7.1 as new deprecations cannot be introduced in patch versions) with a deprecation when you keep using the old error handling behavior. We cannot just change the behavior in 8.0.

@carsonbot carsonbot changed the title Fix backwards compatibility for invalid commands [Process] Fix backwards compatibility for invalid commands Sep 6, 2024
@nicolas-grekas nicolas-grekas force-pushed the fix/command-line-array-bc branch from 1941795 to e13bf4e Compare September 6, 2024 09:41
@nicolas-grekas
Copy link
Member

Thank you @ausi.

@nicolas-grekas nicolas-grekas merged commit 15158aa into symfony:7.1 Sep 6, 2024
1 of 2 checks passed
@fabpot fabpot mentioned this pull request Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants