[wp-trac] [WordPress Trac] #42634: Regression: Wordpress 4.9 does not parse DB_HOST socket paths with colons correctly
WordPress Trac
noreply at wordpress.org
Fri Nov 24 05:50:02 UTC 2017
#42634: Regression: Wordpress 4.9 does not parse DB_HOST socket paths with colons
correctly
--------------------------+--------------------
Reporter: natacado | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.9.1
Component: Database | Version: 4.9
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+--------------------
Comment (by dd32):
Replying to [comment:2 natacado]:
> This patch depends on the fact that a socket path will always be
absolute so we can search for `:/` in the string; the old code seemed to
already assume this for IPv6 but didn't do so in IPv4 code, so ... maybe
there's someone out there using something like
It looks like that was actually a bug with the parsing of the hostname, as
it was incorrectly stripping the `/` from IPv6 socket names, so it can't
have worked anyway :)
I don't actually think many of the cases below would ever be actually
used, but documenting here the weirdness of the edge cases which came up:
- `::1:/tmp/sock` (`$host` is `::1:`, `$socket` is 'tmp/sock')
- `[::1]:/tmp/sock` (`$host` is `::1:`, `$socket` is null)
- `1.2.3.4:1234:/tmp/sock` (`$socket` is null, `$host` is `1`, `$port` is
null)
The patch makes them all parse "correctly", I've added some unit tests
too. So I'm going to commit this to trunk with the hope that @pento can
review it before I merge it to 4.9.1.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42634#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list