????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.144.97.63 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/mysqli/tests/ |
Upload File : |
--TEST-- mysqli_change_user() - GET_LOCK() --SKIPIF-- <?php require_once('skipif.inc'); require_once('skipifemb.inc'); require_once('skipifconnectfailure.inc'); die("skip - is the server still buggy?"); ?> --INI-- max_execution_time=240 --FILE-- <?php require_once('connect.inc'); require_once('table.inc'); // We need this little hack to be able to re-run the test $lock = 'phptest_' . mt_rand(0, 100000); $thread_id = mysqli_thread_id($link); printf("Testing GET_LOCK()...\n"); if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock))) printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!$row = mysqli_fetch_assoc($res)) printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if ($row['_ok'] != 1) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); else printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id); mysqli_free_result($res); // GET_LOCK("phptest") should be released /* From the mysql_change_user documentation: This command resets the state as if one had done a new connect. (See Section 25.2.13, “Controlling Automatic Reconnect Behavior”.) It always performs a ROLLBACK of any active transactions, closes and drops all temporary tables, and unlocks all locked tables. Session system variables are reset to the values of the corresponding global system variables. Prepared statements are released and HANDLER variables are closed. Locks acquired with GET_LOCK() are released. These effects occur even if the user didn't change. */ mysqli_change_user($link, $user, $passwd, $db); sleep(5); $new_thread_id = mysqli_thread_id($link); printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id); if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok')) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!$row = mysqli_fetch_assoc($res)) printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if ($row['_ok'] != NULL) printf("[006] Lock '%s' should have been released, [%d] %s\n", $lock, mysqli_errno($link), mysqli_error($link)); printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id); if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok')) printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!$row = mysqli_fetch_assoc($res)) printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if ($row['_ok'] != 1) printf("[009] Lock '%s' should have been released, [%d] %s\n", $lock, mysqli_errno($link), mysqli_error($link)); mysqli_free_result($res); /* Ok, let's try a NEW connection and a NEW lock! */ mysqli_close($link); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[010] Cannot open new connection, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); do { $newlock = 'phptest_' . mt_rand(0, 100000); } while ($lock == $newlock); $new_thread_id = mysqli_thread_id($link); printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id); if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok')) printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!$row = mysqli_fetch_assoc($res)) printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if ($row['_ok'] != NULL) printf("[013] Lock '%s' should have been released, [%d] %s\n", $lock, mysqli_errno($link), mysqli_error($link)); print "done!"; ?> --CLEAN-- <?php require_once("clean_table.inc"); ?> --EXPECTF-- Testing GET_LOCK()... ... lock 'phptest_%d' acquired by thread %d ... calling IS_USED_LOCK() on 'phptest_%d' using thread '%d' ... calling IS_FREE_LOCK() on 'phptest_%d' using thread '%d' ... calling IS_USED_LOCK() on 'phptest_%d' using new connection with thread '%d' done!