Open
Description
Description
According to the documentation, the third parameter in mysqli_change_user
is nullable (not optional though) and passing NULL should connect to the same database.
If desired, the null value may be passed resulting in only changing the user and not selecting a database. To select a database in this case use the mysqli_select_db() function.
But to my knowledge this was never possible and is still not supported by mysqli. This code will reset database to NULL
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
$mysqli->change_user("my_user", "my_password", null);
var_dump($mysqli->query("SELECT DATABASE()")->fetch_row()[0]);
Resulted in this output:
NULL
But I expected this output instead:
string(4) "test"
PHP Version
All versions
Operating System
No response