fix: Function mysqli_ping() is deprecated since 8.4 and no longer tries to reconnect since PHP 8.2#165
fix: Function mysqli_ping() is deprecated since 8.4 and no longer tries to reconnect since PHP 8.2#165
Function mysqli_ping() is deprecated since 8.4 and no longer tries to reconnect since PHP 8.2#165Conversation
This PR resolves "Deprecated: Function mysqli_ping() is deprecated since 8.4" warnings. https://www.php.net/manual/en/mysqli.ping.php https://php.watch/versions/8.2/mysqli-libmysql-no-longer-supported#mysqli-reconnect
|
This proposed change doesn't really implement everything that mysqli_ping() does, which we rely upon - |
Co-authored-by: Andrija Vučinić <andrija.vucinic@gmail.com>
Function mysqli_ping() is deprecated since 8.4Function mysqli_ping() is deprecated since 8.4 and no longer tries to reconnect since PHP 8.2
|
Interesting,
|
|
| return true; | ||
| } | ||
|
|
||
| // Let the hyperdb logic reconnect us. |
There was a problem hiding this comment.
Still thinking about this... @vnsavage wanted the reconnect logic here VS letting hyperdb just do its thing.
The reconnect was removed and wasn't working since at least 8.2. Considering that the fallback was good enough, not sure what value is there in having the reconnect re-implemented. In theory, it would be a bit faster then going through all of the logic for finding a server to connect to.
|
Iliya had a good observation. If we get Lines 1402 to 1407 in 2b329ab And I think with that, and some testing it's good to go. |
Disconnect from database on server gone error.
| HYPERDB_SERVER_GONE_ERROR == $this->dbhname_heartbeats[ $this->dbhname ]['last_errno'] ) { | ||
| unset( $this->dbhname_heartbeats[ $this->dbhname ]['last_errno'] ); | ||
| return true; | ||
| $this->disconnect( $this->dbhname ); | ||
| return false; |
There was a problem hiding this comment.
Nope. I don't think that's enough. It needs to behave the same way as this block:
Lines 523 to 532 in 8a51769
So we either move the HYPERDB_SERVER_GONE_ERROR check there, or and disconnect/break for PHP < 8.0.0 or we rewrite the check a bit.
|




This PR resolves
Deprecated: Function mysqli_ping() is deprecated since 8.4warnings.The change has been checked internally and works fine - the lost connection is detected, the re-connection takes place and the query is sent properly.
Resources