Closed
Description
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 from0
to0:0
. - Implement a workaround that removes
bindto
from the stream context is it has been set to0
. - 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.