Skip to content

Psr18Client requires allow_url_fopen #41798

Closed
@araab

Description

@araab

Symfony version(s) affected: 5.3.2

Description
Psr18Client from http-client requires allow_url_fopen to be active.
I implemented a test command with the example from the official documentation:
https://symfony.com/doc/current/http_client.html#psr-18-and-psr-17

With allow_url_fopen it works, but when it is disabled I get the following error:

$ php -d allow_url_fopen=off bin/console app:test
[critical] Error thrown while running command "app:test". Message: "Warning: fopen(): symfony:// wrapper is disabled in the server configuration by allow_url_fopen=0"


In StreamWrapper.php line 74:


  Warning: fopen(): symfony:// wrapper is disabled in the server configuration by allow_url_fopen=0



app:test [--option1] [--] [<arg1>] 

How to reproduce

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $r = $this->request->createRequest('GET', 'https://symfony.com/versions.json');
        $response = $this->client->sendRequest($r);
        var_dump($response->getBody()->getContents());


        return Command::SUCCESS;
    } 

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