|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 25 = ?
Subscribe to this entry?

 [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 17:01:24 2021 UTC