2007-10-10 10:16:00 +00:00
|
|
|
--TEST--
|
|
|
|
mysqli_kill()
|
|
|
|
--SKIPIF--
|
2009-05-28 14:33:43 +00:00
|
|
|
<?php
|
2007-10-10 10:16:00 +00:00
|
|
|
require_once('skipif.inc');
|
2009-05-28 14:33:43 +00:00
|
|
|
require_once('skipifemb.inc');
|
2007-10-10 10:16:00 +00:00
|
|
|
require_once('skipifconnectfailure.inc');
|
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
include "connect.inc";
|
|
|
|
|
|
|
|
$tmp = NULL;
|
|
|
|
$link = NULL;
|
|
|
|
|
|
|
|
if (!is_null($tmp = @mysqli_kill()))
|
|
|
|
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
|
|
|
|
|
|
|
if (!is_null($tmp = @mysqli_kill($link)))
|
|
|
|
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
|
|
|
|
|
|
|
require('table.inc');
|
|
|
|
|
|
|
|
// Zend will cast the NULL to 0
|
|
|
|
if (!is_bool($tmp = mysqli_kill($link, null)))
|
|
|
|
printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
|
|
|
|
|
|
|
|
if (!$thread_id = mysqli_thread_id($link))
|
|
|
|
printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
|
|
|
|
|
|
$tmp = mysqli_kill($link, $thread_id);
|
|
|
|
if (!is_bool($tmp))
|
|
|
|
printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
|
|
|
|
|
|
|
|
if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1"))
|
|
|
|
pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
|
|
|
|
|
|
|
|
var_dump($error = mysqli_error($link));
|
|
|
|
if (!is_string($error) || ('' === $error))
|
|
|
|
printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
|
|
|
|
var_dump($res);
|
|
|
|
var_dump($link);
|
2009-05-29 11:01:06 +00:00
|
|
|
if ($IS_MYSQLND) {
|
|
|
|
if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
|
|
|
|
printf("[008] mysqlnd used to be more verbose and used to support SELECT");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($link->info != NULL) {
|
|
|
|
printf("[008] Time for wonders - libmysql has started to support SELECT, change test");
|
|
|
|
}
|
|
|
|
}
|
2007-10-10 10:16:00 +00:00
|
|
|
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
|
|
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
2009-05-29 11:01:06 +00:00
|
|
|
printf("[009] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
2007-10-10 10:16:00 +00:00
|
|
|
|
|
|
|
mysqli_kill($link, -1);
|
|
|
|
if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
|
|
|
|
(!$tmp = mysqli_fetch_assoc($res))) {
|
2009-05-29 11:01:06 +00:00
|
|
|
printf("[010] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
2007-10-10 10:16:00 +00:00
|
|
|
}
|
|
|
|
var_dump($tmp);
|
|
|
|
mysqli_free_result($res);
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
|
|
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
2009-05-29 11:01:06 +00:00
|
|
|
printf("[011] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
2007-10-10 10:16:00 +00:00
|
|
|
|
|
|
|
mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1);
|
|
|
|
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
|
|
print "done!";
|
|
|
|
?>
|
2009-07-06 14:39:10 +00:00
|
|
|
--CLEAN--
|
|
|
|
<?php
|
|
|
|
require_once("clean_table.inc");
|
|
|
|
?>
|
2007-10-10 10:16:00 +00:00
|
|
|
--EXPECTF--
|
|
|
|
Warning: mysqli_kill(): processid should have positive value in %s on line %d
|
2009-05-28 14:33:43 +00:00
|
|
|
%unicode|string%(%d) "%s"
|
2007-10-10 10:16:00 +00:00
|
|
|
bool(false)
|
2008-03-18 16:57:31 +00:00
|
|
|
object(mysqli)#%d (%d) {
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"affected_rows"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(-1)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"client_info"]=>
|
|
|
|
%unicode|string%(%d) "%s"
|
|
|
|
[%u|b%"client_version"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(%d)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"connect_errno"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(0)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"connect_error"]=>
|
|
|
|
%unicode|string%(0) ""
|
|
|
|
[%u|b%"errno"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(2006)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"error"]=>
|
2009-05-29 11:01:06 +00:00
|
|
|
%unicode|string%(%d) "%s"
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"field_count"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(0)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"host_info"]=>
|
2009-05-29 11:01:06 +00:00
|
|
|
%unicode|string%(%d) "%s"
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"info"]=>
|
2009-05-29 11:01:06 +00:00
|
|
|
%s
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"insert_id"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(0)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"server_info"]=>
|
|
|
|
%unicode|string%(%d) "%s"
|
|
|
|
[%u|b%"server_version"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(%d)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"sqlstate"]=>
|
|
|
|
%unicode|string%(5) "HY000"
|
|
|
|
[%u|b%"protocol_version"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(10)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"thread_id"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(%d)
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"warning_count"]=>
|
2008-03-18 16:57:31 +00:00
|
|
|
int(0)
|
2007-10-10 10:16:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Warning: mysqli_kill(): processid should have positive value in %s on line %d
|
|
|
|
array(1) {
|
2009-05-28 14:33:43 +00:00
|
|
|
[%u|b%"id"]=>
|
|
|
|
%unicode|string%(1) "1"
|
2007-10-10 10:16:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Warning: mysqli_kill(): processid should have positive value in %s on line %d
|
2009-05-28 14:33:43 +00:00
|
|
|
done!
|