-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix bug #67563: mysqli compiled with mysqlnd does not take ipv6 adress as parameter #19750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...s as parameter In the past, when libmysqlclient could be used, it accepted ipv6 addresses as hostname without enclosing it first in brackets. However, in mysqlnd this never worked. In the past this caused a discrepancy between the two implementations. Nowadays, mysqli only works with mysqlnd so we don't even have to cater to libmysqlclient. However, a plain ipv6 address should still work as a hostname. Also for people migrating to newer PHP versions it's nice if this keeps working. The solution is to check if we're dealing with an ipv6 address not yet enclosed in brackets. In that case we add the brackets automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not going to test it but if you have tested that it works then you can merge it. I doubt anyone is using this feature, but in the future someone might.
How does this impact PDO? Is this a new feature in PDO too?
How does this impact PDO? Is this a new feature in PDO too?
This should now also work properly in PDO-MYQSL, whereas previously it did not work.
I don't see it as a new feature though, the address that mysqlnd created was malformed so for me that's a bug 🙂
The change looks good - nice and simple!
About the test, CI should support ::1 and think it's even resolving localhost to ::1 so why can't you add a test connection to ::1 (with maybe some grant update if needed)?
In the past, when libmysqlclient could be used, it accepted ipv6 addresses as hostname without enclosing it first in brackets. However, in mysqlnd this never worked. In the past this caused a discrepancy between the two implementations.
Nowadays, mysqli only works with mysqlnd so we don't even have to cater to libmysqlclient. However, a plain ipv6 address should still work as a hostname. Also for people migrating to newer PHP versions it's nice if this keeps working.
The solution is to check if we're dealing with an ipv6 address not yet enclosed in brackets. In that case we add the brackets automatically.
Testing this automatically seems not straight-forward. The connection string is not logged. Using the fake server requires modifications to specify a host and can't be easily reused in the same phpt file. This was tested by hand.