Skip to content

Commit

Permalink
bug #58704 [HttpClient] fix for HttpClientDataCollector fails if proc…
Browse files Browse the repository at this point in the history
…_open is disabled via php.ini (ZaneCEO)

This PR was merged into the 6.4 branch.

Discussion
----------

[HttpClient] fix for HttpClientDataCollector fails if proc_open is disabled via php.ini

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #58700
| License       | MIT

[HttpClientDataCollector::escapePayload](https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php#L256) creates a `new Process()` -> it fails if `proc_open` is disabled:

> The Process class relies on proc_open, which is not available on your PHP installation.

symfony/symfony#58700

Commits
-------

e28af345004 [HttpClient] Fix Process-based escaping in HttpClientDataCollector
48980a2f05a fix for HttpClientDataCollector fails if proc_open is disabled via php.ini . Closes #58700
  • Loading branch information
nicolas-grekas committed Oct 30, 2024
2 parents 509d0e8 + aa7bebe commit 224124d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DataCollector/HttpClientDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ private function escapePayload(string $payload): string
{
static $useProcess;

if ($useProcess ??= class_exists(Process::class)) {
return (new Process([$payload]))->getCommandLine();
if ($useProcess ??= function_exists('proc_open') && class_exists(Process::class)) {
return substr((new Process(['', $payload]))->getCommandLine(), 3);
}

if ('\\' === \DIRECTORY_SEPARATOR) {
Expand Down

0 comments on commit 224124d

Please sign in to comment.