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

The IPv6 validator does not work

alglyzin opened this issue · comments

if (\preg_match("/\\[(?P<ip>[0-9a-f:]+)\\](:(?P<port>\\d+))?$/", $bindTo, $match)) {

Test:

2a09:d2c1:3:18:7c8e:c108:7b31:782f
1da:00d3:0000:2f3b:02aa:00ff:fe28:9c5a

The normalizeBindToOption() function will throw an exception

Put your ipv6 addressing inside square brackets
[2a09:d2c1:3:18:7c8e:c108:7b31:782f]
[1da:00d3:0000:2f3b:02aa:00ff:fe28:9c5a]