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

Skip to content

Commit ac3631a

Browse files
committed
bug symfony#44538 [Process] fixed uppercase ARGC and ARGV should also be skipped (rbaarsma)
This PR was submitted for the 5.4 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Process] fixed uppercase ARGC and ARGV should also be skipped | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony#44534 | License | MIT | Doc PR | no uppercase env ARGC and ARGV were showing a warning: ``` [09-Dec-2021 17:17:05 Europe/Amsterdam] PHP Warning: Array to string conversion in /var/www/app/vendor/symfony/process/Process.php on line 344 ``` This PR fixes that by adding upon the existing functionality blocking argv and argc env vars to become part of the eventual env vars. Commits ------- 0ced90c [Process] fixed uppercase ARGC and ARGV should also be skipped
2 parents 2381e0d + 0ced90c commit ac3631a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public function start(callable $callback = null, array $env = [])
340340

341341
$envPairs = [];
342342
foreach ($env as $k => $v) {
343-
if (false !== $v && 'argc' !== $k && 'argv' !== $k) {
343+
if (false !== $v && false === \in_array($k, ['argc', 'argv', 'ARGC', 'ARGV'], true)) {
344344
$envPairs[] = $k.'='.$v;
345345
}
346346
}
@@ -973,8 +973,6 @@ public function addErrorOutput(string $line)
973973

974974
/**
975975
* Gets the last output time in seconds.
976-
*
977-
* @return float|null The last output time in seconds or null if it isn't started
978976
*/
979977
public function getLastOutputTime(): ?float
980978
{
@@ -1503,8 +1501,6 @@ private function resetProcessData()
15031501
* @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants)
15041502
* @param bool $throwException Whether to throw exception in case signal failed
15051503
*
1506-
* @return bool True if the signal was sent successfully, false otherwise
1507-
*
15081504
* @throws LogicException In case the process is not running
15091505
* @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
15101506
* @throws RuntimeException In case of failure

0 commit comments

Comments
 (0)