1--TEST-- 2mysqli_change_user(), MySQL 5.6+ 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7 8if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 9 die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 10 $host, $user, $db, $port, $socket)); 11 12if (mysqli_get_server_version($link) < 50600) 13 die("SKIP For MySQL >= 5.6.0"); 14 15if (mysqli_get_server_version($link) >= 10_00_00) 16 die("SKIP Not applicable for MariaDB"); 17?> 18--FILE-- 19<?php 20 require_once("connect.inc"); 21 22 $tmp = NULL; 23 $link = NULL; 24 25 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 26 printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 27 $host, $user, $db, $port, $socket); 28 29 /* Pre 5.6: link remains useable */ 30 if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db))) 31 printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp); 32 33 if (!$res = mysqli_query($link, 'SELECT 1 AS _one')) 34 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 35 else 36 var_dump($res->fetch_assoc()); 37 38 print "done!"; 39?> 40--EXPECT-- 41[003] [2006] MySQL server has gone away 42done! 43