[PHP-DEV] ext/sockets: socket_getpeername/socket_getsockname BC

Hi,

Working on this PR #17440, I wanted to ask if the BC from these two calls
were ok because :

Before

function socket_getsockname(Socket $socket, &$address, &$port = null): bool {}

After

function socket_getsockname(Socket $socket, &$address, ?int &$objint = null): bool {}

As it is no longer only used for port but also for. interface address index in the case of AF_PACKET.

Thanks.

Regards.

Am 29.01.2025 um 04:20 schrieb David CARLIER <devnexen@gmail.com>:

Working on this PR #17440, I wanted to ask if the BC from these two calls were ok because :

Before
  function socket_getsockname(Socket $socket, &$address, &$port = null): bool {}

After
  function socket_getsockname(Socket $socket, &$address, ?int &$objint = null): bool {}

As it is no longer only used for port but also for. interface address index in the case of AF_PACKET.

Personally I would leave it at $port for two reasons:
1) BC break without a big benefit
2) I don't think $objint is a meaningful name

While it might not be 100% accurate for AF_PACKET I think the concept of a port is well enough established in the networking word and the more common usage (AF_INET*) makes me think this inconsistency with AF_PACKET is not a real problem.

Regards,
- Chris

On Wed, Jan 29, 2025 at 4:22 AM David CARLIER <devnexen@gmail.com> wrote:

Hi,

Working on this PR #17440, I wanted to ask if the BC from these two calls
were ok because :

Before

function socket_getsockname(Socket $socket, &$address, &$port = null): bool {}

After

function socket_getsockname(Socket $socket, &$address, ?int &$objint = null): bool {}

As it is no longer only used for port but also for. interface address index in the case of AF_PACKET.

Please no BC break. It’s really not worth it.

Cheers

Jakub

Ok fair enough, will revert it.

Cheers.

On Wed, 29 Jan 2025 at 12:04, Jakub Zelenka <bukka@php.net> wrote:

On Wed, Jan 29, 2025 at 4:22 AM David CARLIER <devnexen@gmail.com> wrote:

Hi,

Working on this PR #17440, I wanted to ask if the BC from these two calls
were ok because :

Before

function socket_getsockname(Socket $socket, &$address, &$port = null): bool {}

After

function socket_getsockname(Socket $socket, &$address, ?int &$objint = null): bool {}

As it is no longer only used for port but also for. interface address index in the case of AF_PACKET.

Please no BC break. It's really not worth it.

Cheers

Jakub