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: -
From: havijoori at protonmail dot com Assigned:
Status: Open Package: *Network Functions
PHP Version: 7.4.5 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Aug 15 12:01:25 2020 UTC