Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpClient] Crash for some URLs #44617

Copy link
Copy link
Closed
@peter17

Description

@peter17
Issue body actions

Symfony version(s) affected

6.0.1

Description

Some URLs produce an error with Symfony HttpClient. The error is:

PHP Fatal error:  Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /var/www/html/vendor/symfony/http-client/Response/TransportResponseTrait.php:129

How to reproduce

Here is an example:

<?php

use Symfony\Component\HttpClient\HttpClient;

require_once __DIR__.'/vendor/autoload_runtime.php';

$client = HttpClient::create();

$client->request('GET', 'http://flyshooting-ios.casual.g.mi.com/.env.bak', ['timeout' => 5])->getContent();

The output:

PHP Warning:  Undefined array key "url" in /var/www/html/vendor/symfony/http-client/Response/TransportResponseTrait.php on line 129
PHP Warning:  curl_multi_exec(): Could not call the CURLOPT_HEADERFUNCTION in /var/www/html/vendor/symfony/http-client/Response/CurlResponse.php on line 302
PHP Fatal error:  Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /var/www/html/vendor/symfony/http-client/Response/TransportResponseTrait.php:129
Stack trace:
#0 /var/www/html/vendor/symfony/http-client/Response/TransportResponseTrait.php(129): implode('', NULL)
#1 /var/www/html/vendor/symfony/http-client/Response/CurlResponse.php(379): Symfony\Component\HttpClient\Response\CurlResponse::addResponseHeaders(Array, Array, Array)
#2 /var/www/html/vendor/symfony/http-client/Response/CurlResponse.php(88): Symfony\Component\HttpClient\Response\CurlResponse::parseHeaderLine(Object(CurlHandle), 'HTTP/1.1 000 ', Array, Array, Array, Object(Symfony\Component\HttpClient\Internal\CurlClientState), 9, NULL, Object(Closure), NULL)
#3 [internal function]: Symfony\Component\HttpClient\Response\CurlResponse::Symfony\Component\HttpClient\Response\{closure}(Object(CurlHandle), 'HTTP/1.1 000 ')
#4 /var/www/html/vendor/symfony/http-client/Response/CurlResponse.php(302): curl_multi_exec(Object(CurlMultiHandle), 0)
#5 /var/www/html/vendor/symfony/http-client/Response/TransportResponseTrait.php(178): Symfony\Component\HttpClient\Response\CurlResponse::perform(Object(Symfony\Component\HttpClient\Internal\CurlClientState), Array)
#6 /var/www/html/vendor/symfony/http-client/Response/CommonResponseTrait.php(149): Symfony\Component\HttpClient\Response\CurlResponse::stream(Array, NULL)
#7 /var/www/html/vendor/symfony/http-client/Response/CommonResponseTrait.php(44): Symfony\Component\HttpClient\Response\CurlResponse::initialize(Object(Symfony\Component\HttpClient\Response\CurlResponse))
#8 /var/www/html/vendor/symfony/http-client/Response/CurlResponse.php(244): Symfony\Component\HttpClient\Response\CurlResponse->doGetContent(true)
#9 /var/www/html/test.php(12): Symfony\Component\HttpClient\Response\CurlResponse->getContent()
#10 /var/www/html/vendor/autoload_runtime.php(9): require('/var/www/html/t...')
#11 /var/www/html/test.php(7): require_once('/var/www/html/v...')
#12 {main}
  thrown in /var/www/html/vendor/symfony/http-client/Response/TransportResponseTrait.php on line 129

I believe that some kind of firewall is blocking the request hence causing an invalid (or at least weird) response:

$ curl -vvv http://flyshooting-ios.casual.g.mi.com/.env.bak
*   Trying 20.47.97.231:80...
* Connected to flyshooting-ios.casual.g.mi.com (20.47.97.231) port 80 (#0)
> GET /.env.bak HTTP/1.1
> Host: flyshooting-ios.casual.g.mi.com
> User-Agent: curl/7.74.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 000 
< Date: Tue, 14 Dec 2021 14:12:58 GMT
< Content-Type: text/html
< Content-Length: 0
< Connection: keep-alive
< Server: MonKing/3.14
< Xiaomi-Security-Center: if any vulnerability found, go https://sec.xiaomi.com
< 
* Connection #0 to host flyshooting-ios.casual.g.mi.com left intact

Possible Solution

No response

Additional Context

Thanks a lot in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.