adminer icon indicating copy to clipboard operation
adminer copied to clipboard

Connecting to socket did not work after support for ipv6 in 5.4.0

Open magnusvin opened this issue 4 months ago • 2 comments

image

The commit f921dafa breaks behavior that previously worked.

I’ve added comments in the commit messages explaining what each change does and split the commits accordingly.

When the host is empty due to :/unix_socket_path, I now check for that and omit the host in the DSN.

The behavior from this line has been moved into the host_port function.

Because 5.4.0 introduced breaking behavior on my part, I manually fixed the adminer.php file like this: image

Shouldn't the CI tests pass? I agree that I should separate the PRs as suggested in #1183.

magnusvin avatar Oct 27 '25 23:10 magnusvin

Your first commit breaks connecting to IPv6. Describe your input to the server field, the expected behavior and the actual behavior.

vrana avatar Oct 28 '25 09:10 vrana

@vrana You are correct — sorry about that!

I have made a new change and tested the following combinations:

Server DSN
[fd00:dead:beef::3] mysql:charset=utf8;host=fd00:dead:beef::3
[fd00:dead:beef::3]:3306 mysql:charset=utf8;host=fd00:dead:beef::3;port=3306
[fd00:dead:beef::3]:/var/www/mysql.sock mysql:charset=utf8;host=fd00:dead:beef::3;unix_socket=/var/www/mysql.sock
[::1] mysql:charset=utf8;host=::1
[::1]:3306 mysql:charset=utf8;host=::1;port=3306
[::1]:/var/www/mysql.sock mysql:charset=utf8;host=::1;unix_socket=/var/www/mysql.sock
:/var/www/mysql.sock mysql:charset=utf8;unix_socket=/var/www/mysql.sock
localhost:/var/www/mysql.sock mysql:charset=utf8;host=localhost;unix_socket=/var/www/mysql.sock
example.com mysql:charset=utf8;host=example.com
example.com:3306 mysql:charset=utf8;host=example.com;port=3306
example.com:/var/www/mysql.sock mysql:charset=utf8;host=example.com;unix_socket=/var/www/mysql.sock
127.0.0.1 mysql:charset=utf8;host=127.0.0.1
127.0.0.1:3306 mysql:charset=utf8;host=127.0.0.1;port=3306
127.0.0.1:/var/www/mysql.sock mysql:charset=utf8;host=127.0.0.1;unix_socket=/var/www/mysql.sock
db-master mysql:charset=utf8;host=db-master
db-master:3306 mysql:charset=utf8;host=db-master;port=3306

Everything should now work as expected. IPv4, IPv6 and domain with port or socket works.

This is specifically to the first commit that was wrong (host_port) and should now be equivalent to the old behaviour before 5.4.0.

magnusvin avatar Oct 28 '25 20:10 magnusvin