PHP 8.1: MySQLi: mysqli_driver->driver_version property is deprecated

Version8.1
TypeDeprecation

mysqli_driver->driver_version property from the MySQLi extension is deprecated in PHP 8.1.

$driver = new mysqli_driver();
echo $driver->driver_version; // 101009
Deprecated: The driver_version property is deprecated in ... on line ...

The mysqli_driver->driver_version property was not updated for many years, at least since 2007, and the driver version is a useless value because despite the changes in the driver (such as default error mode change in PHP 8.1), the driver version has not changed.

Related Changes

Backwards Compatibility Impact

Using mysqli_driver->driver_version will emit a deprecation notice in PHP 8.1, and will be removed in PHP 9.0.

Because this value has not changed for over a decade, it is safe to drop any version number checks that used the driver_version property. Any code that needs to determine the driver version can use the standard \PHP_VERSION_ID constant.


Implementation