Skip to content

Fix implicit/explicit port in mysqlnd #11990

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

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

kamil-tekiela
Copy link
Member

Fixes #8978 (partially). Ref #10922

@nielsdos I had another look at this. I observed that the connection is opened just fine even with the doubled port. The SSL fails due to missing certificate. However, the error message was incorrect and misleading. I don't know if we should still fix the doubled port, but at least to fix the reported issue we should only fix error message. What do you think?

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch as-is makes sense. This can go in as a separate fix.

I don't know if we should still fix the doubled port

So the connection will still fail because of this problem, right?
I believe it should be fixed, can be seperate from this PR.

Actually, the patch from #10922 can be used with a little modification to make it work with ipv6.
The problem in that PR was strchr(hostname.s, ':') == NULL because : may occur in ipv6 addresses.

AFAIK ipv6 is only supported with square brackets right?
In that case we may modify your original PR code to:

if (strchr(hostname.s, ':') == NULL || (hostname.s[0] == '[' && strstr(hostname.s, "]:") == NULL)) {
	transport.l = mnd_sprintf(&transport.s, 0, "tcp://%s:%u", hostname.s, port);
} else {
	transport.l = mnd_sprintf(&transport.s, 0, "tcp://%s", hostname.s);
}

I believe that would do the right thing?

@kamil-tekiela
Copy link
Member Author

So the connection will still fail because of this problem, right?
I believe it should be fixed, can be seperate from this PR.

That I do not know as I was not able to reproduce this. That's why I am not going to pursue that fix anymore.

@nielsdos
Copy link
Member

So the connection will still fail because of this problem, right?
I believe it should be fixed, can be seperate from this PR.

That I do not know as I was not able to reproduce this. That's why I am not going to pursue that fix anymore.

Aha okay, that makes sense.

@kamil-tekiela kamil-tekiela merged commit c1103a9 into php:PHP-8.1 Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants