Skip to content

Commit 5a5fa68

Browse files
Merge branch '6.4' into 7.1
* 6.4: [HttpClient] Close gracefull when the server closes the connection abruptly read runtime config from composer.json in debug dotenv command
2 parents e5f4ec5 + 3615a3b commit 5a5fa68

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Symfony/Component/Dotenv/Command/DebugCommand.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8181
return 1;
8282
}
8383

84-
$filePath = $_SERVER['SYMFONY_DOTENV_PATH'] ?? $this->projectDirectory.\DIRECTORY_SEPARATOR.'.env';
84+
if (!$filePath = $_SERVER['SYMFONY_DOTENV_PATH'] ?? null) {
85+
$dotenvPath = $this->projectDirectory;
86+
87+
if (is_file($composerFile = $this->projectDirectory.'/composer.json')) {
88+
$runtimeConfig = (json_decode(file_get_contents($composerFile), true))['extra']['runtime'] ?? [];
89+
90+
if (isset($runtimeConfig['dotenv_path'])) {
91+
$dotenvPath = $this->projectDirectory.'/'.$runtimeConfig['dotenv_path'];
92+
}
93+
}
94+
95+
$filePath = $dotenvPath.'/.env';
96+
}
8597

8698
$envFiles = $this->getEnvFiles($filePath);
8799
$availableFiles = array_filter($envFiles, 'is_file');

src/Symfony/Component/HttpClient/Response/CurlResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private static function perform(ClientState $multi, ?array &$responses = null):
323323
}
324324

325325
$multi->handlesActivity[$id][] = null;
326-
$multi->handlesActivity[$id][] = \in_array($result, [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, \CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, \CURLINFO_CONTENT_LENGTH_DOWNLOAD) ? null : new TransportException(ucfirst(curl_error($ch) ?: curl_strerror($result)).sprintf(' for "%s".', curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL)));
326+
$multi->handlesActivity[$id][] = \in_array($result, [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, \CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, \CURLINFO_CONTENT_LENGTH_DOWNLOAD) || (curl_error($ch) === 'OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0' && -1.0 === curl_getinfo($ch, \CURLINFO_CONTENT_LENGTH_DOWNLOAD) && \in_array('close', array_map('strtolower', $responses[$id]->headers['connection']), true)) ? null : new TransportException(ucfirst(curl_error($ch) ?: curl_strerror($result)).sprintf(' for "%s".', curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL)));
327327
}
328328
} finally {
329329
$multi->performing = false;

0 commit comments

Comments
 (0)