[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 08:41:17 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:
-------------------------------------+------------------------------
Changes (by schlessera):

 * keywords:   => has-patch needs-testing


Comment:

 I've provided a first patch that changes the way the host is parsed. Now,
 `DB_HOST` values like `::1` or `[::1]:3306` are correctly parsed and
 forwarded.

 I couldn't find any prior tests that check the `DB_HOST` values, so not
 sure how this could be properly tested. I could write some unit tests for
 the `wpdb::parse_db_host()` method, but without more specific data on what
 is acceptable to `mysqli` (which I couldn't find yet), I'm not sure that
 will tell us much.

 Note: `mysqli_real_connect()` seems to require the IPv6 hosts to always be
 enclosed in square brackets, at least on my system (PHP 7.0.20 + MariaDB
 10.2.6).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41722#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list