[php-src] Issue #20532: socket_addrinfo_lookup no way to get return code

From: Date: Wed, 19 Nov 2025 19:46:09 +0000
Subject: [php-src] Issue #20532: socket_addrinfo_lookup no way to get return code
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251252@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20532 Author: murrant ### Description I need to differentiate between different kinds of host lookup failures. getaddrinfo() includes the following return codes I am interested in: EAI_AGAIN, EAI_FAIL, EAI_FAMILY, EAI_NODATA, EAI_NONAME (and the others might be helpful for others) Currently there is no way to get the return code. My instinctual attempt to get the error was to try socket_last_error(), but this always returns 0 (Success). I then took a look at the source code and the return code is not retained. All non-zero return codes just return false without storing the error code in any way. In sockets.c: ```c if (getaddrinfo(ZSTR_VAL(hostname), service, &hints, &result) != 0) { RETURN_FALSE; } ``` Is there any way to get the error code currently? Would new code need to be implemented to allow access to the error codes?

« previous php.bugs (#251252) next »