Annotation of embedaddon/php/ext/mysqli/tests/mysqli_kill.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli_kill()
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifemb.inc');
! 7: require_once('skipifconnectfailure.inc');
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: require_once("connect.inc");
! 12:
! 13: $tmp = NULL;
! 14: $link = NULL;
! 15:
! 16: if (!is_null($tmp = @mysqli_kill()))
! 17: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 18:
! 19: if (!is_null($tmp = @mysqli_kill($link)))
! 20: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 21:
! 22: require('table.inc');
! 23:
! 24: // Zend will cast the NULL to 0
! 25: if (!is_bool($tmp = mysqli_kill($link, null)))
! 26: printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
! 27:
! 28: if (!$thread_id = mysqli_thread_id($link))
! 29: printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 30:
! 31: $tmp = mysqli_kill($link, $thread_id);
! 32: if (!is_bool($tmp))
! 33: printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
! 34:
! 35: if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1"))
! 36: pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
! 37:
! 38: var_dump($error = mysqli_error($link));
! 39: if (!is_string($error) || ('' === $error))
! 40: printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
! 41: var_dump($res);
! 42: var_dump($link);
! 43: if ($IS_MYSQLND) {
! 44: if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
! 45: printf("[008] mysqlnd used to be more verbose and used to support SELECT");
! 46: }
! 47: if ($link->stat != NULL) {
! 48: printf("[009] NULL expected because of error.\n");
! 49: }
! 50: } else {
! 51: if ($link->info != NULL) {
! 52: printf("[010] Time for wonders - libmysql has started to support SELECT, change test");
! 53: }
! 54: }
! 55:
! 56: mysqli_close($link);
! 57:
! 58: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 59: printf("[011] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 60:
! 61: mysqli_kill($link, -1);
! 62: if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
! 63: (!$tmp = mysqli_fetch_assoc($res))) {
! 64: printf("[012] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 65: }
! 66: var_dump($tmp);
! 67: mysqli_free_result($res);
! 68: mysqli_close($link);
! 69:
! 70: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 71: printf("[013] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 72:
! 73: mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1);
! 74:
! 75: mysqli_close($link);
! 76:
! 77: print "done!";
! 78: ?>
! 79: --CLEAN--
! 80: <?php
! 81: require_once("clean_table.inc");
! 82: ?>
! 83: --EXPECTF--
! 84: Warning: mysqli_kill(): processid should have positive value in %s on line %d
! 85: %unicode|string%(%d) "%s"
! 86: bool(false)
! 87: object(mysqli)#%d (%d) {
! 88: [%u|b%"affected_rows"]=>
! 89: int(-1)
! 90: [%u|b%"client_info"]=>
! 91: %unicode|string%(%d) "%s"
! 92: [%u|b%"client_version"]=>
! 93: int(%d)
! 94: [%u|b%"connect_errno"]=>
! 95: int(0)
! 96: [%u|b%"connect_error"]=>
! 97: NULL
! 98: [%u|b%"errno"]=>
! 99: int(2006)
! 100: [%u|b%"error"]=>
! 101: %unicode|string%(%d) "%s"
! 102: [%u|b%"field_count"]=>
! 103: int(0)
! 104: [%u|b%"host_info"]=>
! 105: %unicode|string%(%d) "%s"
! 106: [%u|b%"info"]=>
! 107: %s
! 108: [%u|b%"insert_id"]=>
! 109: int(0)
! 110: [%u|b%"server_info"]=>
! 111: %unicode|string%(%d) "%s"
! 112: [%u|b%"server_version"]=>
! 113: int(%d)
! 114: ["stat"]=>
! 115: %s
! 116: [%u|b%"sqlstate"]=>
! 117: %unicode|string%(5) "HY000"
! 118: [%u|b%"protocol_version"]=>
! 119: int(10)
! 120: [%u|b%"thread_id"]=>
! 121: int(%d)
! 122: [%u|b%"warning_count"]=>
! 123: int(0)
! 124: }
! 125:
! 126: Warning: mysqli_kill(): processid should have positive value in %s on line %d
! 127: array(1) {
! 128: [%u|b%"id"]=>
! 129: %unicode|string%(1) "1"
! 130: }
! 131:
! 132: Warning: mysqli_kill(): processid should have positive value in %s on line %d
! 133: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>