PHP 8.1: mysqli::get_client_info
method and mysqli_get_client_info($param)
is deprecated
In PHP 8.1, mysqli::get_client_info
method (OOP style), and passing parameters to the mysqli_get_client_info
function is deprecated.
mysqli_get_client_info
function and the mysqli::get_client_info
method return the MySQLi client version as a string. This value is static across a PHP setup, and it does not change depending on the connection.
mysqli_get_client_info();
// "mysqlnd 8.1.0-dev"
mysqli::get_client_info
method deprecation
The get_client_info
method in the mysqli
class is deprecated in PHP 8.1. Attempting to call it emits a deprecation notice.
$connection->get_client_info();
Deprecated: Method mysqli::get_client_info() is deprecated in ...
It is straight-forward to avoid the deprecation warning across all PHP versions by replacing the call with the equivalent mysqli_get_client_info
function:
- $info = $connection->get_client_info();
+ $info = mysqli_get_client_info();
mysqli_get_client_info
with parameters deprecation
Passing any parameters to the mysqli_get_client_info
function results in PHP 8.1 and later emitting a deprecating notice.
mysqli_get_client_info($connection);
Deprecated: mysqli_get_client_info(): Passing connection object as an argument is deprecated in ...
To avoid the deprecation notice on all PHP versions, call the mysqli_get_client_info
function without any parameters.
- $info = mysqli_get_client_info($connection);
+ $info = mysqli_get_client_info();
Related Changes
Backwards Compatibility Impact
The deprecation notices can be easily avoided by replacing them with a mysqli_get_client_info()
function call, that returns identical values.