--TEST-- mysqli_set_charset() --SKIPIF-- --FILE-- set_charset('invalid'); } catch (\mysqli_sql_exception $exception) { echo "Exception: " . $exception->getMessage() . "\n"; } try { $link->set_charset('ucs2'); } catch (\mysqli_sql_exception $exception) { echo "Exception: " . $exception->getMessage() . "\n"; } mysqli_close($link); try { mysqli_set_charset($link, $new_charset); } catch (Error $exception) { echo $exception->getMessage() . "\n"; } print "done!"; ?> --CLEAN-- --EXPECTF-- Exception: %s Exception: Variable 'character_set_client' can't be set to the value of 'ucs2' mysqli object is already closed done!