php.net |  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:
MUST BE VALID
Solve the problem:
48 - 25 = ?
Subscribe to this entry?

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

$ dig -x 146.229.226.10 @8.8.8.8 +short
Dr\032Zhang's\032desktop.ds.uah.edu.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

this is pretty nosense - learn about https://www.punycoder.com/ 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 desktop.ds.uah.edu" 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] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-12-18 13:43 UTC] cmb@php.net
Indeed, that would rather be an upstream issue.  FWIW, Windows
also reports "Dr Zhang's desktop.ds.uah.edu".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Apr 12 17:01:24 2021 UTC