Skip to content

Class *** Not Found issue in php-http/discovery #296

Closed
@ShinJii89

Description

@ShinJii89

PHP version: 8.0.19 (but it also happened on 7.4.x)

Description
After installation of composer require mailerlite/mailerlite-api-v2-php-sdk (0.3.2, in 0.2.3 it's working fine [because they are using older version of php-http in 0.2.3]) I'm getting errors from php-http/discovery... that errors are just displaying as strings in my script (like echo)... not fatal errors/warnings in php level...
Some more informations here (like my composer.json, composer.lock): mailerlite/mailerlite-api-v2-php-sdk#50

If I'm not use any HTTP CLIENT in their RestClient then their code do this:

if (is_null($this->httpClient)) {
            $this->httpClient = Psr18ClientDiscovery::find();
        }

        return $this->httpClient;

And then my script shows me Class Phalcon/Http/Message/RequestFactory not foundClass Phalcon/Http/Message/RequestFactory not foundClass Symfony/Component/HttpClient/HttplugClient not foundClass Http/Adapter/Guzzle7/Client not foundClass Http/Adapter/Guzzle6/Client not foundClass Http/Adapter/Guzzle5/Client not foundClass Http/Client/Socket/Client not foundClass Http/Adapter/Buzz/Client not foundClass Http/Adapter/React/Client not foundClass Http/Adapter/Cake/Client not foundClass Http/Adapter/Zend/Client not foundClass Http/Adapter/Artax/Client not foundClass Symfony/Component/HttpClient/Psr18Client not foundClass Symfony/Component/HttpClient/Psr18Client not foundClass Symfony/Component/HttpClient/Psr18Client not foundClass Buzz/Client/FileGetContents not foundClass Buzz/Client/FileGetContents not foundClass Buzz/Client/FileGetContents not foundClass Phalcon/Http/Message/ResponseFactory not foundClass Phalcon/Http/Message/ResponseFactory not foundClass Phalcon/Http/Message/StreamFactory not foundClass Phalcon/Http/Message/StreamFactory not found

But when I change their code of HTTP CLIENT to something like

if (is_null($this->httpClient)) {
            $options = [
                CURLOPT_CONNECTTIMEOUT => 10,
                CURLOPT_SSL_VERIFYPEER => false
            ];

            $this->httpClient = new CurlClient(Psr17FactoryDiscovery::findResponseFactory(), Psr17FactoryDiscovery::findStreamFactory(), $options);
        }

        return $this->httpClient;

my script shows just:
Class Phalcon/Http/Message/RequestFactory not foundClass Phalcon/Http/Message/RequestFactory not foundClass Phalcon/Http/Message/ResponseFactory not foundClass Phalcon/Http/Message/ResponseFactory not foundClass Phalcon/Http/Message/StreamFactory not foundClass Phalcon/Http/Message/StreamFactory not found

QUESTION IS WHY? Why it's showing something like that if i'm not using that http client? And it happens only if I install their newest version of library (I can install many other libraries and something like that just not happening)...but I checked their code and I don't see anything wrong... I guess it's your fault but why?

How to reproduce
I don't know, maybe install their library

Possible Solution

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions