Add an additional condition before reconnect()
#47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR checks if the connection has been established before we call the
reconnect()
method.When a connection to the database is lost, the
$this->db->connID
remains valid in terms of its existence, but the actual connection might be closed or invalid.There are no actual tests for this because I don't know how I can test it - we have a valid DB connection during the tests. Although I confirmed this was a bug and this change fixes it.
Needs
#46Fixes #45
Checklist: