PHP 8.1: MySQLi: New MYSQLI_REFRESH_REPLICA constant
In PHP 8.1, the mysqli extension declares a new constant named MYSQLI_REFRESH_REPLICA, that is equivalent to the existing MYSQLI_REFRESH_SLAVE constant.
This change was made in response to MySQL 8.0.23 that deprecates several options containing "slave" with "replica" due to their racial insensitivity.
The existing
MYSQLI_REFRESH_SLAVEconstant is not removed, nor deprecated. There are no immediate plans to remove the existingMYSQLI_REFRESH_SLAVEconstant.
Note that this change does not affect PDO or pdo_mysql extensions in any way.
The new MYSQLI_REFRESH_REPLICA can be used with any MySQL version PHP 8.1 supports (MySQL 5.5 and up).
Backwards Compatibility Impact
MYSQLI_REFRESH_REPLICA is a new constant, unless there is a user-declared constant with the same name, this change should not cause any issues.
It is possible to polyfill this constant by simply declaring the MYSQLI_REFRESH_REPLICA constant to the value of MYSQLI_REFRESH_SLAVE.
if (!defined('MYSQLI_REFRESH_REPLICA') && defined('MYSQLI_REFRESH_SLAVE')) {
define('MYSQLI_REFRESH_REPLICA', MYSQLI_REFRESH_SLAVE);
}