-
Notifications
You must be signed in to change notification settings - Fork 7.9k
mysqli_get_client_info doesn't take any parameters #6576
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
That has been done for backwards compatibility, see https://bugs.php.net/78790. |
@cmb69 Backwards compatibility with what? This function never accepted any parameters. I wrote my fix based on that bug report you shared. I really do not understand why this parameter was added. |
The function hasn't had any ZPP, so it accepted arbitrary argument lists (but completely ignored all the arguments). Originally, it was changed to accept no parameter, but due to the bug report, that restriction was lifted. |
That bug report should have been declined. If we accept any kind of such bug reports then people will force us to add any number of useless parameters to all kinds of functions. The function never accepted any parameters so there is no BC. The parameter should not have been added. |
The value is always a string. After all it is a constant, so the null check makes absolutely no sense.
The function did accept arbitrary arguments, and it is not even unreasonable to call a function which correlates to a non-static method with an object instance as argument. Of course, the method should have been static in the first place. And let's not forget, that there is still the non-static property
|
mysqli doesn't use static properties or functions. I assume it was not possible back in the days of PHP 5. Given that this is not a real property, it should have been a constant. I agree with that much, but changing it to a constant would be a BC. Many standard functions accepted any number of arguments in PHP 7. The problem is not restricted to only this function. I believe the idea was to restrict this so that only the functions that explicitly allow variadic arguments can take more than is specified in the signature. This is one of them. People used to pass arbitrary arguments to the function that didn't have a use for them. There are a number of functions that don't take mysqli instance as an argument and belong to mysqli API. This is one of them. We don't have such thing for I just answered a question on SO about the BC with We should stay consistent. Either we disallow passing arbitrary useless arguments to functions that don't need them, or we allow passing any argument to any PHP built-in function. |
Yes, but that usually issues It might be prudent to deprecate passing arguments to this function ASAP. As they say, "Rome wasn't build in a day". :) |
I see this really as a bug. I don't see any need for a deprecation message just like we didn't have any for other functions. Don't listen to the mysqli documentation, it is riddled with mistakes. I don't think it's harsh to start throwing an error in PHP 8 for a rarely used function that had a bug. The bug got fixed and now if you try to use it incorrectly you get an error. If we keep this optional parameter it will only make the confusion worse. After a year we might even forget about this and it will never be fixed properly. When there is a missing error for an incorrect function usage then it is a bug not a feature. We fixed this bug for |
I think the ship for just dropping the parameter in PHP 8 has sailed at this point. It would suggest to change this PR to throw a deprecation notice if the parameter is passed, to make sure that we can at least drop it in the future. |
Agreed. PR is on its way. |
mysqli_get_client_info()
doesn't take any parameters and it never did. This seems to have been a regression in PHP 8.0.As documented in PHP manual
mysqli_get_client_info
doesn't need the connection link. Prior to PHP 8.0 the function didn't take any arguments, so it makes no sense to add it now. This function is just a wrapper around a constant in the client library. Mysqlnd always has this constant set (duh) but I am unable to test against libmysql. However, if it is not set in libmysql then that would have been noticed ages ago since we have a test case for this already https://github.com/php/php-src/blob/master/ext/mysqli/tests/068.phptThis PR reverts the previous commit and adjusts the stub file.