[wp-trac] [WordPress Trac] #41722: wpdb::db_connect() does not connect to IPv6 address of mysql server
WordPress Trac
noreply at wordpress.org
Sun Aug 27 12:16:58 UTC 2017
#41722: wpdb::db_connect() does not connect to IPv6 address of mysql server
-------------------------------------+------------------------------
Reporter: fierevere | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 4.8.1
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+------------------------------
Comment (by birgire):
There seems to be some inconsistancy how ipv6 is handled by mysqlnd,
that's a part of the PHP distribution since 5.3.0.
(http://php.net/manual/en/mysqlinfo.library.choosing.php ) and
libmysqlclient, according the the comments here:
https://bugs.php.net/bug.php?id=67563
{{{
[2015-04-18 13:48 UTC] bobe at webnaute dot net
There is a real problem here because mysqlnd wants the IPv6 address to be
enclosed
in brackets (illogical since mysqli_connect() or PDO wants a host, not a
url).
But when using libmysqlclient, these extensions wants the IPv6 address NOT
to be enclosed in brackets.
}}}
{{{
[2015-04-18 14:30 UTC] bobe at webnaute dot net
Here is some tests:
PDO mysql + mysqlnd:
[::1] => ok
::1 => getaddrinfo failed
mysqli_connect() + mysqlnd:
[::1] => ok
::1 => getaddrinfo failed
mysql_connect() + mysqlnd:
[::1] => Failed to parse IPv6 address "[:3306"
::1 => No such file or directory
PDO mysql + libmysqlclient:
[::1] => SQLSTATE[HY000] [2005] Unknown MySQL server host '[::1]'
::1 => ok
mysqli_connect() + libmysqlclient:
[::1] => (HY000/2005): Unknown MySQL server host '[::1]'
::1 => ok
mysql_connect() + libmysqlclient:
[::1] => Unknown MySQL server host '[' (2)
::1 => Can't connect to local MySQL server through socket '1'
}}}
This would need to be verified for mysqli_real_connect().
Wonder if this should be handled by WordPress (lib-detecting) or if it
should be up to the user to provide the correct ipv6 form based on the
underlying lib? I think the latter would be confusing to users.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41722#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list