Skip to content

Conversation

@lucasnetau
Copy link
Contributor

Useful to ensure PHP sockets are notified of socket failure when Sockets may be closed incorrectly and data can no longer be transmitted. eg Firewall dropping connection or peer device failure (commonly seen with Cloud load balancers).

From tcp(7) :It specifies the maximum amount of time in milliseconds that transmitted data may remain unacknowledged, or buffered data may remain untransmitted (due to zero window size) before TCP will forcibly close the corresponding connection and return ETIMEDOUT to the application.

Following #13816 for PR format for socket constants/

@devnexen
Copy link
Member

I see what is happening and why it fails on release 64 bits, the code block is in the wrong place. You just need to move it up in the IPPROTO_TCP section (~line 2082)

@lucasnetau
Copy link
Contributor Author

I see what is happening and why it fails on release 64 bits, the code block is in the wrong place. You just need to move it up in the IPPROTO_TCP section (~line 2082)

I've moved it up to the IPPROTO_TCP block, I've also followed the setting of the option per the other two options in the IPPROTO_TCP block

socket_set_block($socket);

try {
socket_setopt($socket, SOL_TCP, TCP_USER_TIMEOUT, -1);
Copy link
Member

@devnexen devnexen Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: now I see it s working, please add a test with a large number (e.g. PHP_INT_MAX)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after that, that will be all :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I account for differences in 32-bit and 64-bit PHP versions. PHP_INT_MAX will be less than UINT_MAX on 32-bit versions

UINT_MAX 4294967295
PHP_INT_MAX (32-bit) 2147483647
PHP_INT_MAX (64-bit) 9223372036854775807

I know we can test for PHP_INT_MAX = 4 and skip the check, however unsure how I would then handle the missing output in 32-bit EXPECTF (seperate test case?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants