|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79558 gethostbyaddr()'s problem with some characters
Submitted: 2020-05-02 18:40 UTC Modified: 2020-12-18 13:43 UTC
From: havijoori at protonmail dot com Assigned: cmb (profile)
Status: Not a bug Package: *Network Functions
PHP Version: 7.4.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: havijoori at protonmail dot com
New email:
PHP Version: OS:


 [2020-05-02 18:40 UTC] havijoori at protonmail dot com
gethostbyaddr function does not work properly if the hostname contains some characters.
For example, gethostbyaddr("") returns but the correct answer is :

$ dig -x @ +short


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-02 18:47 UTC] bugreports at gmail dot com
> Dr\032Zhang's\

this is pretty nosense - learn about or show the RFC which is *not* some draft allowing such chars as hostname
 [2020-05-27 17:10 UTC] php at mcq8 dot be
This is not a bug in PHP.
It depends on how your system handles invalid domain names.
On alpine your example resolves to "Dr Zhang's" on debian it returns the ip when it fails to resolve.
You can try and file a bugreport at glibc, but I doubt they will accept requests for domains with invalid chars.
 [2020-12-18 13:43 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-12-18 13:43 UTC]
Indeed, that would rather be an upstream issue.  FWIW, Windows
also reports "Dr Zhang's".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Apr 12 15:01:24 2021 UTC