Author: uwendel
Date: 2007-08-13 11:18:18 +0200 (Mon, 13 Aug 2007)
New Revision: 878
Modified:
trunk/tests/ext/mysqli/mysqli_pconn_kill.phpt
Log:
mysqlnd really gets confused if you kill persistent connections. Even the result handles
seem to return wrong data.
Modified: trunk/tests/ext/mysqli/mysqli_pconn_kill.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_pconn_kill.phpt 2007-08-10 14:52:19 UTC (rev 877)
+++ trunk/tests/ext/mysqli/mysqli_pconn_kill.phpt 2007-08-13 09:18:18 UTC (rev 878)
@@ -16,30 +16,30 @@
<?php
require_once("connect.inc");
require_once("table.inc");
-
+
$host = 'p:' . $host;
if (!$plink = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
-
+
// get the thread ids of the two connections...
$thread_id = mysqli_thread_id($link);
$pthread_id = mysqli_thread_id($plink);
-
+
if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
-
+
$running_threads = array();
while ($row = mysqli_fetch_assoc($res))
$running_threads[$row['Id']] = $row;
mysqli_free_result($res);
-
+
if (count($running_threads) < 2)
printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!isset($running_threads[$thread_id]))
printf("[004] Cannot find thread id of the regular link, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
-
+
if (!isset($running_threads[$pthread_id]))
printf("[005] Cannot find thread id of the persistent link, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
@@ -47,15 +47,15 @@
if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
mysqli_close($plink);
-
- if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
+
+ if (!$res2 = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
-
+
$running_threads2 = array();
- while ($row = mysqli_fetch_assoc($res))
+ while ($row = mysqli_fetch_assoc($res2))
$running_threads2[$row['Id']] = $row;
- mysqli_free_result($res);
-
+ mysqli_free_result($res2);
+
if (isset($running_threads2[$pthread_id]))
printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!isset($running_threads2[$thread_id]))
@@ -63,27 +63,27 @@
// On PHP side this should do nothing. PHP should not try to close the connection or
something.
@mysqli_close($plink);
-
+
if (!$plink = @mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!$res = @mysql_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1'))
+ if (!$res3 = @mysql_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1'))
printf("[012] New persistent connection cannot execute queries, [%d] %s\n",
@mysqli_errno($plink), @mysqli_error($plink));
-
- @mysqli_free_result($res);
+
+ @mysqli_free_result($res3);
@mysqli_close($plink);
mysqli_close($link);
-
+
// remove the "p:<host>" from the host variable
$host = substr($host, 2);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!$res = mysql_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1'))
+ if (!$res4 = mysql_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1'))
printf("[014] New regular connection cannot execute queries, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
- mysqli_close($link);
+
+ mysqli_free_result($res4);
+ mysqli_close($link);
print "done!";
?>
--EXPECTF--
| Thread |
|---|
| • PHP mysqlnd svn commit: r878 - trunk/tests/ext/mysqli | uwendel | 13 Aug |