[Console] work around disabled putenv()
authorSenTisso <38100632+SenTisso@users.noreply.github.com>
Sat, 12 Sep 2020 15:15:36 +0000 (17:15 +0200)
committerNicolas Grekas <nicolas.grekas@gmail.com>
Tue, 15 Sep 2020 07:58:55 +0000 (09:58 +0200)
src/Symfony/Component/Console/Application.php

index da5c987..bc3f23b 100644 (file)
@@ -114,8 +114,10 @@ class Application implements ResetInterface
      */
     public function run(InputInterface $input = null, OutputInterface $output = null)
     {
-        putenv('LINES='.$this->terminal->getHeight());
-        putenv('COLUMNS='.$this->terminal->getWidth());
+        if (\function_exists('putenv')) {
+            @putenv('LINES='.$this->terminal->getHeight());
+            @putenv('COLUMNS='.$this->terminal->getWidth());
+        }
 
         if (null === $input) {
             $input = new ArgvInput();
@@ -980,7 +982,9 @@ class Application implements ResetInterface
             $input->setInteractive(false);
         }
 
-        putenv('SHELL_VERBOSITY='.$shellVerbosity);
+        if (\function_exists('putenv')) {
+            @putenv('SHELL_VERBOSITY='.$shellVerbosity);
+        }
         $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
         $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
     }