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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: havijoori at protonmail dot com
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 00:01:31 2024 UTC