mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-19722: Windows: _get_osfhandle asserts in debug mode when given a socket
Closes GH-19725.
This commit is contained in:
committed by
Niels Dossche
parent
472f2fe0a3
commit
94625a0e4c
4
NEWS
4
NEWS
@@ -61,6 +61,10 @@ PHP NEWS
|
||||
. Fix arginfo/zpp violations when LIBXML_SCHEMAS_ENABLED is not available.
|
||||
(nielsdos)
|
||||
|
||||
- Windows:
|
||||
. Fix GH-19722 (_get_osfhandle asserts in debug mode when given a socket).
|
||||
(dktapps)
|
||||
|
||||
23 Oct 2025, PHP 8.3.27
|
||||
|
||||
- Core:
|
||||
|
||||
@@ -62,8 +62,10 @@ PHPAPI int php_select(php_socket_t max_fd, fd_set *rfds, fd_set *wfds, fd_set *e
|
||||
/* build an array of handles for non-sockets */
|
||||
for (i = 0; (uint32_t)i < max_fd; i++) {
|
||||
if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) {
|
||||
handles[n_handles] = (HANDLE)(uintptr_t)_get_osfhandle(i);
|
||||
if (handles[n_handles] == INVALID_HANDLE_VALUE) {
|
||||
int _type;
|
||||
int _len = sizeof(_type);
|
||||
|
||||
if (getsockopt((SOCKET)i, SOL_SOCKET, SO_TYPE, (char*)&_type, &_len) == 0 || WSAGetLastError() != WSAENOTSOCK) {
|
||||
/* socket */
|
||||
if (SAFE_FD_ISSET(i, rfds)) {
|
||||
FD_SET((uint32_t)i, &sock_read);
|
||||
@@ -78,8 +80,11 @@ PHPAPI int php_select(php_socket_t max_fd, fd_set *rfds, fd_set *wfds, fd_set *e
|
||||
sock_max_fd = i;
|
||||
}
|
||||
} else {
|
||||
handle_slot_to_fd[n_handles] = i;
|
||||
n_handles++;
|
||||
handles[n_handles] = (HANDLE)(uintptr_t)_get_osfhandle(i);
|
||||
if (handles[n_handles] != INVALID_HANDLE_VALUE) {
|
||||
handle_slot_to_fd[n_handles] = i;
|
||||
n_handles++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user