Bug #81441 [NEW]: gethostbyaddr('::1') returns ip instead of name after calling some other method

From: Date: Wed, 15 Sep 2021 18:16:25 +0000
Subject: Bug #81441 [NEW]: gethostbyaddr('::1') returns ip instead of name after calling some other method
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236629@lists.php.net to get a copy of this message
From: stefan at buerk dot tech Operating system: alpine-3.13/alpine-3.14 docker PHP version: 8.1.0RC1 Package: *Network Functions Bug Type: Bug Bug description:gethostbyaddr('::1') returns ip instead of name after calling some other method Description: ------------ We have tried to use the alpine docker images for our ci builds to start getting 8.1 compatibility. We had a weired behaviour with using gethostbyaddr('::1') in unit tests. The first call is resolved to 'localhost', or better to say all calls until one other function where called. (Do not know if all, but we had different in between). For example the version_compare(), as this was the first function in phpunit .. which changed the behavior. Maybe it is not php, but we used the same dockerfile as verification, kust switchen php 8 with 8.1 RC1 and getting this weired behaviour. We opend an issue on github for the php docker containers holding a lot of test runs. https://github.com/docker-library/php/issues/1201 Test script: --------------- <?php echo "CHECK ::1 hostname before/after version compare" . PHP_EOL; // duplicationg this line bevore other code lines, would work until something // like version_compare is used. // EXPECTED: localhost echo "#1 IPv6(::1): " . (string)gethostbyaddr('::1') . PHP_EOL; // this line chanes the return in 8.1.0RC1-alpine - but why ? // but even other codelines changed it if (!version_compare(PHP_VERSION, PHP_VERSION, '=')) {} // EXPECTED: localhost => alpine ::1, others localhost as expected echo "#2 IPv6(::1): " . (string)gethostbyaddr('::1') . PHP_EOL; Expected result: ---------------- Getting always the resolved name from /etc/hosts on subsequent calls, even if other scripts are called: CHECK ::1 hostname before/after version compare #1 IPv6(::1): localhost #2 IPv6(::1): localhost Actual result: -------------- CHECK ::1 hostname before/after version compare #1 IPv6(::1): localhost #2 IPv6(::1): ::1 -- Edit bug report at https://bugs.php.net/bug.php?id=81441&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81441&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81441&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81441&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81441&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81441&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81441&r=support Expected behavior: https://bugs.php.net/fix.php?id=81441&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81441&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81441&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81441&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81441&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81441&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81441&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81441&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81441&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81441&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81441&r=mysqlcfg

« previous php.bugs (#236629) next »