From ab8cc29814c066c442899214bbccc889b188e114 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 19 Oct 2015 16:17:09 +0200 Subject: [PATCH] [Process] Inherit env vars by default in PhpProcess --- src/Symfony/Component/BrowserKit/Client.php | 3 +-- src/Symfony/Component/BrowserKit/composer.json | 2 +- .../Component/ClassLoader/ClassCollectionLoader.php | 2 +- src/Symfony/Component/Process/PhpProcess.php | 12 ++++++------ src/Symfony/Component/Process/Process.php | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 95b6419db2b24..1370f1c838605 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -334,8 +334,7 @@ public function request($method, $uri, array $parameters = array(), array $files */ protected function doRequestInProcess($request) { - // We set the TMPDIR (for Macs) and TEMP (for Windows), because on these platforms the temp directory changes based on the user. - $process = new PhpProcess($this->getScript($request), null, array('TMPDIR' => sys_get_temp_dir(), 'TEMP' => sys_get_temp_dir())); + $process = new PhpProcess($this->getScript($request), null, null); $process->run(); if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) { diff --git a/src/Symfony/Component/BrowserKit/composer.json b/src/Symfony/Component/BrowserKit/composer.json index 13ac1b9b68998..429aa0cb07161 100644 --- a/src/Symfony/Component/BrowserKit/composer.json +++ b/src/Symfony/Component/BrowserKit/composer.json @@ -20,7 +20,7 @@ "symfony/dom-crawler": "~2.0,>=2.0.5" }, "require-dev": { - "symfony/process": "~2.0,>=2.0.5", + "symfony/process": "~2.3.34|~2.7,>=2.7.6", "symfony/css-selector": "~2.0,>=2.0.5" }, "suggest": { diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index e576e5c62b090..88bd500f1d2c8 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -283,7 +283,7 @@ private static function getClassHierarchy(\ReflectionClass $class) $traits = array(); - if (function_exists('get_declared_traits')) { + if (method_exists('ReflectionClass', 'getTraits')) { foreach ($classes as $c) { foreach (self::resolveDependencies(self::computeTraitDeps($c), $c) as $trait) { if ($trait !== $c) { diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php index e5777ea22afe7..1adbd977adf88 100644 --- a/src/Symfony/Component/Process/PhpProcess.php +++ b/src/Symfony/Component/Process/PhpProcess.php @@ -27,13 +27,13 @@ class PhpProcess extends Process /** * Constructor. * - * @param string $script The PHP script to run (as a string) - * @param string $cwd The working directory - * @param array $env The environment variables - * @param int $timeout The timeout in seconds - * @param array $options An array of options for proc_open + * @param string $script The PHP script to run (as a string) + * @param string|null $cwd The working directory or null to use the working dir of the current PHP process + * @param array|null $env The environment variables or null to use the same environment as the current PHP process + * @param int $timeout The timeout in seconds + * @param array $options An array of options for proc_open */ - public function __construct($script, $cwd = null, array $env = array(), $timeout = 60, array $options = array()) + public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array()) { $executableFinder = new PhpExecutableFinder(); if (false === $php = $executableFinder->find()) { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 64f6d15cb960b..7580c17d829c5 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -121,7 +121,7 @@ class Process * * @param string $commandline The command line to run * @param string|null $cwd The working directory or null to use the working dir of the current PHP process - * @param array|null $env The environment variables or null to inherit + * @param array|null $env The environment variables or null to use the same environment as the current PHP process * @param string|null $stdin The STDIN content * @param int|float|null $timeout The timeout in seconds or null to disable * @param array $options An array of options for proc_open @@ -851,7 +851,7 @@ public function setEnv(array $env) $this->env = array(); foreach ($env as $key => $value) { - $this->env[(binary) $key] = (binary) $value; + $this->env[$key] = (string) $value; } return $this; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy