amphp / socket

Non-blocking socket and TLS functionality for PHP based on Amp.

Home Page:https://amphp.org/socket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bind failure in connect() remains unreported

bwoebi opened this issue · comments

<?php

include "vendor/autoload.php";
Amp\Socket\connect("127.0.0.1:80", (new Amp\Socket\ConnectContext)->withBindto("127.0.0.2"));

This will silently connect from 127.0.0.1 instead of failing with the following warning: Warning: Failed to bind to '127.0.0.2:0', system said: Can't assign requested address.
(On a mac 127.0.0.1 is the only available local IP, and not the full 127.0.0.0/8 - hence I had this happen, to reproduce on linux use a different IP alltogether.)

This seems to be completely silenced by the set_error_handler(static fn () => true);.