Reconsider usages of `gethostbyname_r()`
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
According to some sources, this function is obsolete and should be replaced with:
Applications should use getaddrinfo(3), getnameinfo(3), and gai_strerror(3) 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for usages of gethostbyname_r() and read ext/standard/file.h around lines 106-110, along with the context from #15511. Compare each usage with getaddrinfo(), getnameinfo(), and gai_strerror(); done means the obsolete calls and no-longer-needed conditional globals are addressed consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100