Bug #81220 [NEW]: gethostbyaddr returns binary garbage

From: Date: Sat, 03 Jul 2021 16:52:46 +0000
Subject: Bug #81220 [NEW]: gethostbyaddr returns binary garbage
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234788@lists.php.net to get a copy of this message
From:             cyr dot k at me dot com
Operating system: FreeBSD
PHP version:      8.1Git-2021-07-03 (Git)
Package:          Network related
Bug Type:         Bug
Bug description:gethostbyaddr returns binary garbage

Description:
------------
gethostbyaddr("109.197.205.75"), for example, returns four seemingly
random bytes string (no, it's not a binary presentation of IPv4
address).
Addresses with proper reverse DNS records still return them as expected,
this one IP doesn't have it.

Test script:
---------------
<?php
file_put_contents("/tmp/wtf.bin", gethostbyaddr("109.197.205.75"));
?>


Expected result:
----------------
Should just return the IP if it cannot find a name for it.

Actual result:
--------------
garbage

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81220&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81220&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81220&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81220&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81220&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81220&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81220&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81220&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81220&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81220&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81220&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81220&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81220&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81220&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81220&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81220&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81220&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81220&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#234788) next »