php / php/php-src

Reconsider usages of `gethostbyname_r()`

Open
#15,531 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Category: Engine Refactoring
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.