0

We have to use GuzzleHttp in a module within a project that is already using this package.

GuzzleHttp/Exception/RequestException tries loading GuzzleHttp\Psr7\get_message_body_summary(), it doesn't load the function because throws that error:

'Whoops\Exception\ErrorException' with message 'Call to undefined function GuzzleHttp\Psr7\get_message_body_summary()' in ...

The functions are not loaded because that:

// Don't redefine the functions if included multiple times.
if (!function_exists('GuzzleHttp\Psr7\str')) {
    require __DIR__ . '/functions.php';       // <<< get_message_body_summary() is here
}

It seens get_message_body_summary() does not exist in the main project's GuzzleHttp.

I don't know what to do to solve the problem...

Updated:

I've created a "vendor-static" directory with the incompatible package inside. It's loaded by composer with:

    "autoload": {
        "psr-4": {
            "Cyberneticos\\Foundation\\Gateway\\": "src",
            "Test\\":"tests/common",
            "GuzzleHttp6\\": "vendor-static/guzzlehttp/guzzle/src/",
            "GuzzleHttp6\\Psr7\\": "vendor-static/guzzlehttp/psr7/src/",
            "GuzzleHttp6\\Promise\\": "vendor-static/guzzlehttp/promises/src/"
        },
        "files": [
            "vendor-static/guzzlehttp/guzzle/src/functions_include.php",
            "vendor-static/guzzlehttp/psr7/src/functions_include.php",
            "vendor-static/guzzlehttp/promises/src/functions_include.php"
        ]
    },

I use now the new GuzzleHttp6 in my project, with no errors.

I found this solution on: How does composer handle multiple versions of the same package?

Javier F.
  • 1
  • 1
  • 2
  • Hey, would you mind providing the version of Guzzle (`composer info guzzlehttp/guzzle`) and your PHP version (`php -v`) in your question? These few things might help someone to replicate the issue. – Matthew Usurp Apr 22 '20 at 12:54
  • 1
    PHP version 7.0 - GuzzleHttp/guzzel 6.5.3. The 6.4.1 version works well because doesn't use GuzzleHttp\Psr7\get_message_body_summary(); – Javier F. Apr 22 '20 at 14:03

0 Answers0