Author: uwendel
Date: 2007-07-18 20:35:53 +0200 (Wed, 18 Jul 2007)
New Revision: 787
Modified:
trunk/tests/ext/mysqli/mysqli_get_proto_info.phpt
trunk/tests/ext/mysqli/mysqli_get_server_info.phpt
trunk/tests/ext/mysqli/mysqli_get_server_version.phpt
trunk/tests/ext/mysqli/mysqli_get_warnings.phpt
trunk/tests/ext/mysqli/mysqli_init.phpt
trunk/tests/ext/mysqli/mysqli_kill.phpt
trunk/tests/ext/mysqli/mysqli_more_results.phpt
trunk/tests/ext/mysqli/mysqli_mysqli_result_invalid_mode.phpt
Log:
Space2Tab for php.net and minor tweaks.
Modified: trunk/tests/ext/mysqli/mysqli_get_proto_info.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_get_proto_info.phpt 2007-07-18 18:34:54 UTC (rev 786)
+++ trunk/tests/ext/mysqli/mysqli_get_proto_info.phpt 2007-07-18 18:35:53 UTC (rev 787)
@@ -5,22 +5,22 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- if (!is_null($tmp = @mysqli_get_proto_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_proto_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- if (!is_int($info = mysqli_get_proto_info($link)) || (0 === $info))
- printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
-
- if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ include "connect.inc";
- print "done!";
+ if (!is_null($tmp = @mysqli_get_proto_info()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_get_proto_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require "table.inc";
+ if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1))
+ printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
+
+ if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_get_server_info.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_get_server_info.phpt 2007-07-18 18:34:54 UTC (rev 786)
+++ trunk/tests/ext/mysqli/mysqli_get_server_info.phpt 2007-07-18 18:35:53 UTC (rev 787)
@@ -5,22 +5,22 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- if (!is_null($tmp = @mysqli_get_server_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_server_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
- printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info),
$info);
-
- if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ include "connect.inc";
- print "done!";
+ if (!is_null($tmp = @mysqli_get_server_info()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_get_server_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require "table.inc";
+ if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
+ printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
+
+ if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments')))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_get_server_version.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_get_server_version.phpt 2007-07-18 18:34:54 UTC (rev
786)
+++ trunk/tests/ext/mysqli/mysqli_get_server_version.phpt 2007-07-18 18:35:53 UTC (rev
787)
@@ -5,19 +5,21 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- if (!is_null($tmp = @mysqli_get_server_version()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_server_version(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- if (!is_int($info = mysqli_get_server_version($link)) || (0 === $info))
- printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
+ include "connect.inc";
- print "done!";
+ if (!is_null($tmp = @mysqli_get_server_version()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_get_server_version(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require "table.inc";
+ /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
+ /* < 30000 = pre 3.2.3, very unlikely! */
+ if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000)))
+ printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info);
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_get_warnings.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_get_warnings.phpt 2007-07-18 18:34:54 UTC (rev 786)
+++ trunk/tests/ext/mysqli/mysqli_get_warnings.phpt 2007-07-18 18:35:53 UTC (rev 787)
@@ -1,144 +1,146 @@
--TEST--
mysqli_get_warnings() - TODO
--SKIPIF--
-<?php
+<?php
require_once('skipif.inc');
-require_once('skipifemb.inc');
+require_once('skipifemb.inc');
require_once('connect.inc');
-
if (!$TEST_EXPERIMENTAL)
- die("skip - experimental (= unsupported) feature");
+ die("skip - experimental (= unsupported) feature");
?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_get_warnings()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_warnings($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_warnings('')))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (false !== ($tmp = mysqli_get_warnings($link))) {
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' !=
get_class($warning)) {
- printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
-
- if (!method_exists($warning, 'next'))
- printf("[009] Borked object, method next is missing\n");
+ include "connect.inc";
- $properties = array_merge(get_object_vars($warning),
get_class_vars(get_class($warning)));
- if (!empty($properties))
- printf("[010] Properties have always been magic, hidden things - why are they
visible now, a BC break...\n");
-
- if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or
not there at all */
- printf("[011] Expecting string/not empty, got %s/%s\n",
gettype($warning->message), $warning->message);
-
- if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or
not there at all */
- printf("[012] Expecting string/not empty, got %s/%s\n",
gettype($warning->sqlstate), $warning->sqlstate);
-
- if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there
at all */
- printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno),
$warning->errno);
-
- if (false !== ($tmp = $warning->next()))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (($tmp = mysqli_warning_count($link)) !== 2)
- printf("[016] Expecting 2 warnings, got %d warnings", $tmp);
-
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' !=
get_class($warning)) {
- printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
-
- if (true !== ($tmp = $warning->next()))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = NULL;
+ $link = NULL;
- if (false !== ($tmp = $warning->next()))
- printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
-
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
-
- if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_null($tmp = @mysqli_get_warnings()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_get_warnings('')))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (false !== ($tmp = mysqli_get_warnings($link))) {
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ?
var_dump($tmp, true) : $tmp));
+ }
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' !=
get_class($warning)) {
+ printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
+
+ if (!method_exists($warning, 'next'))
+ printf("[009] Borked object, method next is missing\n");
+
+ $properties = array_merge(get_object_vars($warning),
get_class_vars(get_class($warning)));
+ if (!empty($properties))
+ printf("[010] Properties have always been magic, hidden things - why are they visible
now, a BC break...\n");
+
+ if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not
there at all */
+ printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message),
$warning->message);
+
+ if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not
there at all */
+ printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate),
$warning->sqlstate);
+
+ if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at
all */
+ printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno),
$warning->errno);
+
+ if (false !== ($tmp = $warning->next()))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (($tmp = mysqli_warning_count($link)) !== 2)
+ printf("[016] Expecting 2 warnings, got %d warnings", $tmp);
+
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' !=
get_class($warning)) {
+ printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
+
+ if (true !== ($tmp = $warning->next()))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $warning->next()))
+ printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+
+ if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($warning = new mysqli_warning($mysqli)))
- printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning),
$warning);
-
- if (!is_string($warning->message) || ('' == $warning->message))
- printf("[025] Expecting string, got %s/%s", gettype($warning->message),
$warning->message);
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object($warning = new mysqli_warning($mysqli)))
+ printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning),
$warning);
+
+ if (!is_string($warning->message) || ('' == $warning->message))
+ printf("[025] Expecting string, got %s/%s", gettype($warning->message),
$warning->message);
+
if (!$mysqli->query("DROP TABLE t1"))
- printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /* Yes, I really want to check if the object property is empty */
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
-
- $warning = new mysqli_warning($mysqli);
- if (false !== ($tmp = $warning->next()))
- printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if ('' != ($tmp = $warning->message))
- printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
- printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ /* Yes, I really want to check if the object property is empty */
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ $warning = new mysqli_warning($mysqli);
+ if (false !== ($tmp = $warning->next()))
+ printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if ('' != ($tmp = $warning->message))
+ printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+
+ if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
+ printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /* out of range, three warnings */
- if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)"))
- printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $warning = new mysqli_warning($mysqli);
- $i = 1;
- while ($warning->next() && ('' != ($tmp = $warning->message)))
- $i++;
- if (3 != $i)
- printf("[034] Expecting three warnings, got %d warnings\n", $i);
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_stmt_init();
- $warning = new mysqli_warning($stmt);
- if (false !== ($tmp = $warning->next()))
- printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ /* out of range, three warnings */
+ if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)"))
+ printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "done!";
+ $warning = new mysqli_warning($mysqli);
+ $i = 1;
+ while ($warning->next() && ('' != ($tmp = $warning->message))) {
+ if (ini_get('unicode.semantics') && !is_unicode($tmp))
+ printf("[033a] Warning should have been a unicode string, got %s/%s", gettype($tmp),
$tmp);
+ $i++;
+ }
+ if (3 != $i)
+ printf("[034] Expecting three warnings, got %d warnings\n", $i);
+
+ $stmt = mysqli_stmt_init();
+ $warning = new mysqli_warning($stmt);
+ if (false !== ($tmp = $warning->next()))
+ printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_init.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_init.phpt 2007-07-18 18:34:54 UTC (rev 786)
+++ trunk/tests/ext/mysqli/mysqli_init.phpt 2007-07-18 18:35:53 UTC (rev 787)
@@ -4,12 +4,19 @@
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
-<?php
- $link = mysqli_init();
- if (!is_object($link) && false !== $link)
- printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n",
gettype($link), $link);
-
- print "done!";
+<?php
+ $link = mysqli_init();
+
+ if (!is_object($link) && false !== $link)
+ printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n",
gettype($link), $link);
+
+ if (is_object($link) && 'mysqli' != get_class($link))
+ printf("[002] Expecting object of type mysqli got object of type %s\n",
get_class($link));
+
+ if ($link)
+ mysqli_close($link);
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_kill.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_kill.phpt 2007-07-18 18:34:54 UTC (rev 786)
+++ trunk/tests/ext/mysqli/mysqli_kill.phpt 2007-07-18 18:35:53 UTC (rev 787)
@@ -5,74 +5,89 @@
<?php require_once('skipifemb.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);
+ include "connect.inc";
- 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);
+ $tmp = NULL;
+ $link = NULL;
- 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);
-
- mysqli_close($link);
-
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[008] Cannot connect, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
-
- mysqli_kill($link, -1);
- if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
- (!$tmp = mysqli_fetch_assoc($res))) {
- printf("[009] Connection should not be gone, [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
- var_dump($tmp);
- mysqli_free_result($res);
- mysqli_close($link);
-
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
-
- mysqli_change_user($link, "This might work if you accept anonymous users in your
setup", "password", $db); mysqli_kill($link, -1);
+ if (!is_null($tmp = @mysqli_kill()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
-
- print "done!";
+ 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);
+
+ mysqli_close($link);
+
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot connect, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+
+ mysqli_kill($link, -1);
+ if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
+ (!$tmp = mysqli_fetch_assoc($res))) {
+ printf("[009] Connection should not be gone, [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+ }
+ var_dump($tmp);
+ mysqli_free_result($res);
+ mysqli_close($link);
+
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+
+ 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!";
?>
--EXPECTF--
Warning: mysqli_kill(): processid should have positive value in %s on line %d
-%s(%d) "%s
+string(%d) "%s"
bool(false)
object(mysqli)#%d (0) {
}
Warning: mysqli_kill(): processid should have positive value in %s on line %d
array(1) {
- [%s]=>
- %s(1) "1"
+ ["id"]=>
+ string(1) "1"
}
Warning: mysqli_kill(): processid should have positive value in %s on line %d
done!
+--UEXPECTF--
+Warning: mysqli_kill(): processid should have positive value in %s on line %d
+unicode(%d) "%s"
+bool(false)
+object(mysqli)#%d (0) {
+}
+
+Warning: mysqli_kill(): processid should have positive value in %s on line %d
+array(1) {
+ ["id"]=>
+ unicode(1) "1"
+}
+
+Warning: mysqli_kill(): processid should have positive value in %s on line %d
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_more_results.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_more_results.phpt 2007-07-18 18:34:54 UTC (rev 786)
+++ trunk/tests/ext/mysqli/mysqli_more_results.phpt 2007-07-18 18:35:53 UTC (rev 787)
@@ -1,100 +1,98 @@
--TEST--
mysqli_more_results()
--SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifemb.inc');
+<?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
?>
--FILE--
<?php
- include "connect.inc";
-
- $strict_on = false;
- if (defined('E_STRICT')) {
- error_reporting(((int)ini_get('error_reporting')) | E_STRICT );
- $strict_on = true;
- }
+ include "connect.inc";
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_more_results()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_more_results($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $strict_on = false;
+ if (defined('E_STRICT')) {
+ error_reporting(((int)ini_get('error_reporting')) | E_STRICT );
+ $strict_on = true;
+ }
- require('table.inc');
-
- print "[004]\n";
- var_dump(mysqli_more_results($link));
-
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM
test ORDER BY id LIMIT 3"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "[006]\n";
- $i = 1;
-
- if ($strict_on)
- ob_start();
-
- if (mysqli_get_server_version($link) > 41000 && !($ret =
mysqli_more_results($link)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
- do {
- $res = mysqli_store_result($link);
- mysqli_free_result($res);
- if (mysqli_more_results($link))
- printf("%d\n", $i++);
- } while (mysqli_next_result($link));
-
- if ($strict_on) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next
result set@ismU', $tmp)) {
- printf("[008] Strict Standards warning missing\n");
- } else {
- $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line
\d+@ism', '', $tmp));
- }
- print trim($tmp) . "\n";
- }
-
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM
test ORDER BY id LIMIT 3"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "[010]\n";
- $i = 1;
- if (mysqli_get_server_version($link) > 41000 && !($ret =
mysqli_more_results($link)))
- printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
-
- if ($strict_on)
- ob_start();
- do {
- $res = mysqli_use_result($link);
- // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other
info function,
- // you must fetch all rows before you can loop to the next result set!
- // See also the MySQL Reference Manual: mysql_use_result()
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- if (mysqli_more_results($link))
- printf("%d\n", $i++);
-
- } while (mysqli_next_result($link));
-
- if ($strict_on) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next
result set@ismU', $tmp)) {
- printf("[008] Strict Standards warning missing\n");
- } else {
- $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line
\d+@ism', '', $tmp));
- }
- print trim($tmp) . "\n";
- }
-
- mysqli_close($link);
+ $tmp = NULL;
+ $link = NULL;
+ if (!is_null($tmp = @mysqli_more_results()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_more_results($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ print "[004]\n";
var_dump(mysqli_more_results($link));
-
- print "done!";
+
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM
test ORDER BY id LIMIT 3"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ print "[006]\n";
+ $i = 1;
+
+ if ($strict_on)
+ ob_start();
+
+ if (mysqli_get_server_version($link) > 41000 && !($ret =
mysqli_more_results($link)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+ do {
+ $res = mysqli_store_result($link);
+ mysqli_free_result($res);
+ if (mysqli_more_results($link))
+ printf("%d\n", $i++);
+ } while (mysqli_next_result($link));
+
+ if ($strict_on) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result
set@ismU', $tmp)) {
+ printf("[008] Strict Standards warning missing\n");
+ } else {
+ $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line \d+@ism',
'', $tmp));
+ }
+ print trim($tmp) . "\n";
+ }
+
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM
test ORDER BY id LIMIT 3"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ print "[010]\n";
+ $i = 1;
+ if (mysqli_get_server_version($link) > 41000 && !($ret =
mysqli_more_results($link)))
+ printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+
+ if ($strict_on)
+ ob_start();
+ do {
+ $res = mysqli_use_result($link);
+ // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info
function,
+ // you must fetch all rows before you can loop to the next result set!
+ // See also the MySQL Reference Manual: mysql_use_result()
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ if (mysqli_more_results($link))
+ printf("%d\n", $i++);
+ } while (mysqli_next_result($link));
+
+ if ($strict_on) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result
set@ismU', $tmp)) {
+ printf("[008] Strict Standards warning missing\n");
+ } else {
+ $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line \d+@ism',
'', $tmp));
+ }
+ print trim($tmp) . "\n";
+ }
+ mysqli_close($link);
+
+ var_dump(mysqli_more_results($link));
+
+ print "done!";
?>
--EXPECTF--
[004]
Modified: trunk/tests/ext/mysqli/mysqli_mysqli_result_invalid_mode.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_mysqli_result_invalid_mode.phpt 2007-07-18 18:34:54 UTC
(rev 786)
+++ trunk/tests/ext/mysqli/mysqli_mysqli_result_invalid_mode.phpt 2007-07-18 18:35:53 UTC
(rev 787)
@@ -5,18 +5,18 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
- do {
- $mode = mt_rand(-1000, 1000);
- } while (in_array($mode, $valid));
-
- if (!is_object($res = new mysqli_result($link, $mode)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
+ do {
+ $mode = mt_rand(-1000, 1000);
+ } while (in_array($mode, $valid));
+
+ if (!is_object($res = new mysqli_result($link, $mode)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_result::mysqli_result(): Invalid value for resultmode in %s on line %d
| Thread |
|---|
| • PHP mysqlnd svn commit: r787 - trunk/tests/ext/mysqli | uwendel | 18 Jul |