Skip to content

[BUG] 8.1.0RC1 alpine images have broken networking/gethostbyaddr behaviour #1201

@sbuerk

Description

@sbuerk

We wanted to add php 8.1.0RC1 to our testing chain to start early mitigate issues in our projec(s).

As we uses the alpine images as base (size etc) we added the 8.1.0RC1 one and detected weired behaviors. We narrowed it down and can reproduce it with a simple test script.

Background: We have tests resolving '::1' ipv6 and should resolved to "localhost" or at least something other then ::1. What was weired is, that id did not worked. We moved it to the start of phpunit, from where we stripped down the test-file.

But it is 8.1.0RC1 not per se, local install works and even the other (as far as tested) seems to work, only the alpine onces are broken

To make sure we do not intrude the issue through our Dockerfile which installs further packages, we tested it against the original images build/released from here:

Create "test-folder/test.php" with following code:

<?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;

Test commands with outputs (in folder where test.php was created):
Note: not all, just some as cross checks

// not working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1-alpine php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): ::1
// not working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1-alpine3.13 php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): ::1
// not working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1-alpine3.14 php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): ::1
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.0-alpine php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.0-alpine3.13 php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.0-alpine3.13 php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1-cli php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1 php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1-cli-buster php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost
// working
$ docker run -it --rm --name blub -v "$PWD":/myapp -w /myapp php:8.1.0RC1-buster php test.php

CHECK ::1 hostname before/after version compare
#1 IPv6(::1): localhost
#2 IPv6(::1): localhost

Basicly for 8.0 the sambe base images are used for alpine, and I did not found (yet) a different betwenn the 8.1.0RC1 builds
from 8.0 which would explain this.

Anyone a clue how to "stabalize" it ?

Note: Checked /etc/hosts in the container, it has the right entries.

Thanks for any hints, how we can fix it on our sides - or where this behavour comes from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions