[php-src] Issue #15531: Reconsider usages of `gethostbyname_r()`
| From: | Girgias | Date: | Wed, 21 Aug 2024 21:55:53 +0000 |
| Subject: | [php-src] Issue #15531: Reconsider usages of `gethostbyname_r()` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247569@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15531
Author: Girgias
### Description
According to some [sources](https://man7.org/linux/man-pages/man3/gethostbyname.3.html), this
function is obsolete and should be replaced with:
> Applications should use
> [getaddrinfo(3)](https://man7.org/linux/man-pages/man3/getaddrinfo.3.html),
> [getnameinfo(3)](https://man7.org/linux/man-pages/man3/getnameinfo.3.html), and
> [gai_strerror(3)](https://man7.org/linux/man-pages/man3/gai_strerror.3.html) instead.
Moreover, getting rid of them would allow us to get remove some conditionally defined globals:
https://github.com/php/php-src/blob/69d9c12df64e829befd843175bfc9617aabb7450/ext/standard/file.h#L106-L110
Initially found while working on #15511