go to bug id or search bugs for
This seems to be a regression in 7.0.18. If you give a port in the $host section of mysqli_connect, it will still add ":3306" to the end of it.
> mysqli_connect("127.0.0.1:3306", "user", "pass", "schema");
> mysqli_connect(): (HY000/2002): Failed to parse address "127.0.0.1:3306:3306"
Notice the double port assignment. People should be using the $port parameter if mysqli_connect and not giving ports like this, but it still seems like a regression to me. Thanks!
# Works in 7.0.17, broken in 7.0.18
mysqli_connect("127.0.0.1:3306", "user", "pass", "schema");
Add a Patch
Add a Pull Request
Sara, could you please check? Seems there might be other regressions related to #74216.
I _think_ I am having somehow similar problem when using Predis, where I have port defined inside $host variable instead of having it separately in $port.
`Failed to parse address "localhost:6379:" [tcp://localhost:6379:]`
Predis is using `stream_socket_client()` function.
It works in 5.6 but I think it stopped working in new PHP 7 version.
OMG. Why is every use of streams wrong?
Yeah, I'll clean mysqli_connect() up for the "port parameter not used" case.
Oh, and as to predis, that's a bug in predis appending ":$port" when $port doesn't actually contain any value. Someone should send a pull request regarding these lines: https://github.com/nrk/predis/blob/6ab10b2b705ea5121f2c1ea87a290f6871c32ebd/src/Connection/StreamConnection.php#L156-L160
dig dig dig...
So, this may only be happening to mysqli_connect() if mysqlnd is enabled (which is typical), though in the mysqlnd enabled case it looks like you can't actually use an IPv6 address unless you explicitly wrap it in square brackets.
This rabbit hole keeps getting deeper. :(
Patch for bug #74432 reverted, thereby this issue is fixed.
Related To: Bug #74432
Oops, wrong bug number, bug #74216.
Also, please test the release candidates.