-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixed bug #75448 - In case of failure, mysqli::prepare() returns NULL instead of FALSE #2885
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
I see this patch introduces new failures in the tests. Some functions like |
Hi @morozov Like I mentioned in the bug report, this changes all functionality of mysqli, as other methods/functions uses this check to that now will return false instead of null. Please fix the test to make Travis/AppVeyor pass in case the PR gets a greenlight |
@KalleZ right now the master builds are failing both on Travis and AppVeyor. How do I make sure I fix all the newly introduced failures? Maybe I can temporarily rebase to some stable branch?
Before I proceed with the tests, are we in agreement this change is acceptable? Otherwise, what would the fix to docs look like? Do we need to update documentation for every single affected method and add that actually it can also return null in the case of closed connection? Isn't it even more work to legitimize the existing inconsistent behavior? Speaking of a potential BC break, what should the code look like to be broken by this change? |
Hi @morozov You can manually run the tests like [n]make test TESTS=ext/mysqli/tests or see what Travis/AppVeyor is complaining about here: If the mysql guys agree with this change, then the patch by a brief review looks fine. If we end up with docs having to be updated, then our docs are located in SVN (phpdoc under svn.php.net). In reality we have to update every single .xml file for every method this affects, but we can do some magic here on the docs perspective by defining an entity that can be used for copy/pasting. I can assist you if thats where we are headed. Code that will be broken by this is code that is relying on specific NULL return values, tho I doubt there is many but it can happen any time you change the return value of something, hence why I want to be cautious :) |
At the moment, the following tests fail on ZTS build on travis:
Locally, on a ZTS build, I was unable to reproduce any of them. Some of them report memory leaks like:
I think I could use some help figuring out how to fix them. |
@KalleZ I've just managed to finish the patch. Could you take a look or suggest someone else who could? |
Comment on behalf of pollita at php.net: |
The patch is way larger than initially expected due to the following:
MYSQLI_FETCH_RESOURCE
macro which handles the situation of a closed connection is used by many othermysqli_*
functions, so the change in the macro affects those functions as well. I reviewed the documentation articles for some of them, and none claimed that the function was expected to returnNULL
.mysqli_class_mysqli_properties_no_conn.phpt
showed that the values ofmysqli
class properties should be consistent with the return values of the corresponding functions, so I modifiedCHECK_STATUS
andMYSQLI_GET_MYSQL
as well.