Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd68412

Browse files
committed
feature#10930 [Process] Deprecate using values that are not string for Process::setStdin and ProcessBuilder::setInput (romainneutron)
This PR was merged into the 2.4-dev branch.Discussion----------[Process] Deprecate using values that are not string for Process::setStdin and ProcessBuilder::setInput| Q | A| ------------- | ---| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets | n/a| License | MITThis deprecates passing a `Process` input any value that is not a strict string. This needs#10929 to be merged.I don't know if the use of `trigger_error` is correct or should be removed.Commits-------9887b83 [Process] Deprecate using values that are not string for Process::setStdin and ProcessBuilder::setInput
2 parentse7971e5 +9887b83 commitbd68412

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

‎UPGRADE-3.0.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,3 +971,4 @@ UPGRADE FROM 2.x to 3.0
971971
972972
* Process::setStdin() and Process::getStdin() have been removed. Use
973973
Process::setInput() and Process::getInput() that works the same way.
974+
* Process::setInput() and ProcessBuilder::setInput() do not accept non-scalar types.

‎src/Symfony/Component/Process/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
* added the convenience method "mustRun"
99
* deprecation: Process::setStdin() is deprecated in favor of Process::setInput()
1010
* deprecation: Process::getStdin() is deprecated in favor of Process::getInput()
11+
* deprecation: Process::setInput() and ProcessBuilder::setInput() do not accept non-scalar types
1112

1213
2.4.0
1314
-----

‎src/Symfony/Component/Process/Process.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,8 @@ public function getInput()
10601060
/**
10611061
* Sets the contents of STDIN.
10621062
*
1063+
* Deprecation: As of Symfony 2.5, this method only accepts scalar values.
1064+
*
10631065
* @param string|null $stdin The new contents
10641066
*
10651067
* @return self The current Process instance

‎src/Symfony/Component/Process/ProcessBuilder.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ public function addEnvironmentVariables(array $variables)
156156
/**
157157
* Sets the input of the process.
158158
*
159+
* Deprecation: As of Symfony 2.5, this method only accepts string values.
160+
*
159161
* @param string|null $input The input as a string
160162
*
161163
* @return ProcessBuilder

‎src/Symfony/Component/Process/ProcessUtils.php‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function escapeArgument($argument)
7575
}
7676

7777
/**
78-
* Validates andnormalized a Process input
78+
* Validates andnormalizes a Process input
7979
*
8080
* @param string $caller The name of method call that validates the input
8181
* @param mixed $input The input to validate
@@ -87,7 +87,11 @@ public static function escapeArgument($argument)
8787
publicstaticfunctionvalidateInput($caller,$input)
8888
{
8989
if (null !==$input) {
90-
if (is_scalar($input) || (is_object($input) &&method_exists($input,'__toString'))) {
90+
if (is_scalar($input)) {
91+
return (string)$input;
92+
}
93+
// deprecated as of Symfony 2.5, to be removed in 3.0
94+
if (is_object($input) &&method_exists($input,'__toString')) {
9195
return (string)$input;
9296
}
9397

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp