-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote mysqli warnings to exceptions #5058
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
@nikic could you tell me if it is really ok to continue? |
Could you please describe under which conditions this error would occur? From what I gathered, it happens if either a) the connection hasn't been opened yet or b) the connection is already closed. I think in principle that would be fine, as it is consistent with us throwing for closed resources. One thing I'm wondering about in particular is how that interacts with the "Gone away" condition. Would that also result in an exception on the next interaction? That might be fragile. |
You are right, this is my understanding (and experience after working on the tests) as well. Additionally, the resource of prepared statements and results should be open when accessing them in order to avoid throwing an exception.
Yep, throwing also makes sense for me, mainly I was unsure about the possible BC impact. |
e6b360b
to
49e2a22
Compare
I've looked a bit closer at this now, it should be good to go ahead. I've removed two of the conditions in 55618ff, because they cannot occur in practice. The The Apart from these suggestions, this change should be in line with our exception guidelines. |
49e2a22
to
cef1e68
Compare
Thank you, Nikita, for having a detailed look! I updated my PR:
|
9d983d4
to
46a1153
Compare
OMG, I've just noticed that I echoed the exception itself, not just the message... I should have stopped a little bit earlier yesterday... :) |
46a1153
to
17dbd35
Compare
16476b4
to
d6e3124
Compare
75437a5
to
1c5bfd8
Compare
Could you please split off the last commit into a separate PR? It's really a fix for an independent issue, that just becomes more problematic with exceptions. See https://bugs.php.net/bug.php?id=78666 for bug report. |
1c5bfd8
to
848d59d
Compare
848d59d
to
2daf485
Compare
2daf485
to
cee9a59
Compare
cee9a59
to
85e13c0
Compare
It's a nightmare to adapt the tests... So I'll only continue if we make sure that the warnings in question can be promoted to exceptions. :)