-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Require cURL > 7.37.0 #41662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Instead we should skip using the constant when it's not defined. |
Hi, thanks for your answer. I really tried, but not sure where to fix it, since the only line that sets $curlopts[\CURLOPT_HEADEROPT] is https://github.com/symfony/http-client/blob/c7fd9dbab745ab73ec9745f0e745b64a0b297429/CurlHttpClient.php#L176. Also found that CURLOPT_HEADEROPT is defined. PHP Version: 7.4.19 It may be related to: #39889 |
Should be fixed by #41674. |
It's still not working, and throws the same exception. I think the issue is that CURLOPT_HEADEROPT is defined, but not in the state checked by lines 313-318. |
Thanks for the insights. |
This PR was merged into the 5.2 branch. Discussion ---------- [HttpClient] fix compat with cURL <= 7.37 | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41662 | License | MIT | Doc PR | - Commits ------- d8adf51 [HttpClient] fix compat with cURL <= 7.37
Symfony version(s) affected: 5.2.10
Description
Hi. HttpClient throws when cURL version < 7.37.0, which introduced CURLOPT_HEADEROPT. It's a rare issue because compatible versions are available since PHP 7.0.7 (see https://www.php.net/manual/es/function.curl-setopt.php), but there are some hosting companies that doesn't have both upgrades aligned correctly.
How to reproduce
Make an HttpClient request as the "Basic Usage" example on documentation using a server with cURL < 7.37.0.
Possible Solution
Fix requirements on composer.json or make a fallback to NativeHttpClient, which works right on such cases.
Additional context
Log example:
{"message":"Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Curl option "CURLOPT_HEADEROPT" is not supported.")." at /home/c1930506/public_html/nueva-tienda/templates/categorias.html.twig line 1","context":{"exception":{"class":"Twig\Error\RuntimeError","message":"An exception has been thrown during the rendering of a template ("Curl option "CURLOPT_HEADEROPT" is not supported.").","code":0,"file":"/home/c1930506/public_html/nueva-tienda/templates/categorias.html.twig:1","previous":{"class":"Symfony\Component\HttpClient\Exception\TransportException","message":"Curl option "CURLOPT_HEADEROPT" is not supported.","code":0,"file":"/home/c1930506/public_html/nueva-tienda/vendor/symfony/http-client/CurlHttpClient.php:316"}}},"level":500,"level_name":"CRITICAL","channel":"request","datetime":"2021-06-10T16:09:26.076139-03:00","extra":{}}
The text was updated successfully, but these errors were encountered: