-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Process] Add deprecated logs on Process::setInput() and ProcessBuilder::setInput(). #12725
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…er::setInput() which does not accept non-scalar types.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1092,6 +1092,7 @@ public function setStdin($stdin) | |||
* Sets the input. | ||||
* | ||||
* This content will be passed to the underlying process standard input. | ||||
* Deprecation: As of Symfony 2.5, this method only accepts scalar values. | ||||
* | ||||
* @param string|null $input The content | ||||
* | ||||
|
@@ -1101,6 +1102,13 @@ public function setStdin($stdin) | |||
*/ | ||||
public function setInput($input) | ||||
{ | ||||
if (!is_scalar($input)) { | ||||
trigger_error( | ||||
'Passing a non-scalar input is deprecated since version 2.5 and will be removed in 3.0.', | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please format it this way:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @timglabish I thought we have to break lines at 120 char. Are you sure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, everything on one line. |
||||
E_USER_DEPRECATED | ||||
); | ||||
} | ||||
|
||||
if ($this->isRunning()) { | ||||
throw new LogicException('Input can not be set while the process is running.'); | ||||
} | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,7 +167,7 @@ public function addEnvironmentVariables(array $variables) | |
/** | ||
* Sets the input of the process. | ||
* | ||
* Deprecation: As of Symfony 2.5, this method only accepts string values. | ||
* Deprecation: As of Symfony 2.5, this method only accepts scalar values. | ||
* | ||
* @param string|null $input The input as a string | ||
* | ||
|
@@ -177,6 +177,13 @@ public function addEnvironmentVariables(array $variables) | |
*/ | ||
public function setInput($input) | ||
{ | ||
if (!is_scalar($input)) { | ||
trigger_error( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. format is wrong |
||
'Passing a non-scalar input is deprecated since version 2.5 and will be removed in 3.0.', | ||
E_USER_DEPRECATED | ||
); | ||
} | ||
|
||
$this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input); | ||
|
||
return $this; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use a
@deprecated
annotation instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot Are you sure? Adding a
@deprecated
would mean that the entire method is deprecated, at least the IDE will understand it this way. If so I'll have to change it inProcessBuilder::setInput()
too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind