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] Failed to parse address "0" #38081

Copy link
Copy link
Closed
@derrabus

Description

@derrabus
Issue body actions

Symfony version(s) affected: 4.4+

Description
Using the native HTTP client on php 7.3.22 and 7.4.10 produces the following error:

fopen(http://some/url): Failed to open stream: Failed to parse address "0"

How to reproduce
Run the test suite on php 7.3.22 or 7.4.10.

Possible Solution
Either:

  • Change the default value for bindto in the contract from 0 to 0:0.
  • Implement a workaround that removes bindto from the stream context is it has been set to 0.
  • Implement a workaround that adds :0 is the port is missing.
  • Fix php and restore the previous behavior.

Additional context
The problem seems to be that fopen fails if we provide an address without a port as bindto inside the stream context. This is unfortunate because HttpClient uses 0 as a default value, which means that if we don't explicitly set a value here, the request will fail. The default value is provided by the contract's ClientInterface. Changing it to 0:0 makes the tests pass again.

This change has been introduced with php 7.3.22/7.4.10. Running the test suite on php 7.3.21 or 7.4.9 works fine.

Metadata

Metadata

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.