clue · GitHub

The getPort() currently only returns the "port" part and explicitly omits the listening IP. This has been documented as of v0.4.4 and has in fact been like this ever since this method has been added.

This PR replaced this method with a getAddress() method that it returns the full remote address, i.e. IP and port.

- echo $server->getPort();
- 8000
+ echo $server->getAddress();
+ 192.168.0.12:8000

This is obviously a BC break, so I've made sure to add documentation on how to get only the port from the full address with a one-liner.

Empirical evidence seems to suggest the old getPort() method isn't used that much and is mostly used in a context where the full URI likely makes more sense anyway. For TCP/IP based servers, the full URI contains the port and with the above one-liner this switch should be easy.

There are plenty of reasons, let me try to list a few here:

Read the original on github.com ↗