-
Notifications
You must be signed in to change notification settings - Fork 267
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
PHP 8.0 compatibility: function 'setConnectionParameter' (mysqli) #693
Comments
You need to use the predefined constants to identify the option, and not some arbitrary string. In your case:
MYSQLI_SET_CHARSET_NAME That said, the code should not choke on this, so I'll keep this open to fix this |
Thanks for clarification. It now works as expected.
I agree. Thanks for your efforts. Another topic: The documentation of the |
I was actually updating that as you posted... Please check again |
@mnewnham I was wondering why you defined the setConnectionParameter() method as final (see #158, 2e72fe5), this prevents overriding it in a specific driver (mysqli in this case) to add error handling. Of course we could also do the check in ADODB_mysqli::_connect() as well, but it seems cleaner to me to catch the error early. Thoughts ? |
Clearly a mistake. Please revert |
This was a mistake, as discussed in [[1]]. Fixes #694 [1]: #693 (comment)
Add error handling for $parameter type: since mysqli_options() requires an integer, the function now fails and returns false (or throws an exception if enabled) when given a non-numeric value. Fixes #693
Make sure the parameter is numeric, to prevent PHP Warning or TypeError exception when calling mysqli_options(), and if the call fails (e.g. because an unsupported option constant was provided, throw an exception or display an error message instead of silently failing. Fixes #693
PR #701 addresses the problem of ADODB_mysqli->_connect() throwing a TypeError (on PHP 8) or a Warning (on earlier PHP versions) when processing an invalid parameter. |
Make sure the parameter is numeric, to prevent PHP Warning or TypeError exception when calling mysqli_options(), and if the call fails (e.g. because an unsupported option constant was provided, throw an exception or display an error message instead of silently failing. Fixes #693
Versions:
Following your advice given in #686, I tried to use function
setConnectionParameter
.Unfortunately, this leads to another error:
Stackstrace:
My code looks like:
Thanks for investigating the issue.
The text was updated successfully, but these errors were encountered: