uw Thu, 27 May 2010 12:09:39 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=299845
Log:
Test fixes and updates to work with a wider range of MySQL server configs
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt
U
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt
U
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
U
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
U
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
U php/php-src/trunk/ext/mysqli/tests/bug51647.phpt
U php/php-src/trunk/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
U
php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -23,6 +23,6 @@
["Variable_name"]=>
string(10) "Ssl_cipher"
["Value"]=>
- string(%d) "%s"
+ string(%d) "%S"
}
done!
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -15,8 +15,14 @@
--FILE--
<?php
$before = mysqli_get_cache_stats();
- if (!is_array($before) || empty($before)) {
- printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+ /*
+ NOTE: the function belongs to the mysqnd zval cache. The
+ mysqlnd zval cache was part of PHP from PHP 5.3.0(-dev) to
+ PHP 5.3.0RC3 or something. And it was turned off by default.
+ The function never returned anything meaningful in any released version of PHP.
+ */
+ if (!is_array($before)) {
+ printf("[001] Expecting array, got %s.\n", gettype($before));
var_dump($before);
}
@@ -33,25 +39,11 @@
;
$after = mysqli_get_cache_stats();
- /* references has to be maintained - it is used for memory management */
- $ignore = array('references' => true);
- foreach ($before as $k => $v) {
- if (isset($ignore[$k]))
- continue;
-
- if ($before[$k] != $after[$k])
- printf("[004] Statistics have changed - %s: %s => %s\n", $
- $k, $before[$k], $after[$k]);
+ if ($before !== $after) {
+ printf("[002] Statistics have changed\n");
+ var_dump($before);
+ var_dump($after);
}
-
- $ignore = array("size" => true, "free_items" => true, "references" => true);
- foreach ($after as $k => $v) {
- if ($v != 0 && !isset($ignore[$k])) {
- printf("[005] Field %s should not have any other value but 0, got %s.\n",
- $k, $v);
- }
- }
-
mysqli_close($link);
print "done!";
@@ -61,4 +53,4 @@
require_once("clean_table.inc");
?>
--EXPECTF--
-done!
\ No newline at end of file
+done!
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats_off.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats_off.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -15,8 +15,16 @@
--FILE--
<?php
$before = mysqli_get_client_stats();
- if (!is_array($before) || empty($before)) {
- printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+
+ /*
+ NOTE: the function belongs to the mysqnd zval cache. The
+ mysqlnd zval cache was part of PHP from PHP 5.3.0(-dev) to
+ PHP 5.3.0RC3 or something. And it was turned off by default.
+ The function never returned anything meaningful in any released version of PHP.
+
+ */
+ if (!is_array($before)) {
+ printf("[001] Expecting array, got %s.\n", gettype($before));
var_dump($before);
}
@@ -31,12 +39,6 @@
var_dump($after);
}
- foreach ($after as $k => $v)
- if ($v != 0) {
- printf("[003] Field %s should not have any other value but 0, got %s.\n",
- $k, $v);
- }
-
mysqli_close($link);
print "done!";
?>
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -38,8 +38,15 @@
$max_len = pow(2, 24);
if ($org_max_allowed_packet < $max_len) {
- if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100)))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
+ if (1227 == mysqli_errno($link)) {
+ /* [1227] Access denied; you need the SUPER privilege for this operation */
+ print "done!";
+ exit(0);
+ } else {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
}
mysqli_close($link);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
@@ -94,7 +101,8 @@
}
if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1227 != mysqli_errno($link))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -22,14 +22,22 @@
require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ 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);
exit(1);
}
+ $cols = 2500;
+
list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
- printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1227 == mysqli_errno($link)) {
+ /* [1227] Access denied; you need the SUPER privilege for this operation */
+ $cols = 10;
+ } else {
+ $cols = 10;
+ printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
}
mysqli_close($link);
@@ -40,22 +48,21 @@
exit(1);
}
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
exit(1);
}
- $cols = 2500;
$str = array();
for ($i = 1; $i <= $cols; $i++) {
$str[] ="a$i BLOB";
}
- $link->query("CREATE TABLE ps_test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
+ $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
if (mysqli_errno($link)) {
printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die("");
}
- $stmt = $link->prepare("INSERT INTO ps_test VALUES(".str_repeat("?, ", $cols-1) . "?)");
+ $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
var_dump($stmt->id);
$s = str_repeat("a", 2 << 12);
$eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
@@ -77,7 +84,8 @@
if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
- printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1227 != mysqli_errno($link))
+ printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysqli_close($link);
@@ -86,15 +94,7 @@
?>
--CLEAN--
<?php
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
- printf("Failed to drop the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- exit(1);
- }
+ require_once("clean_table.inc");
?>
--EXPECTF--
int(1)
Modified: php/php-src/trunk/ext/mysqli/tests/bug51647.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug51647.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/trunk/ext/mysqli/tests/bug51647.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -23,6 +23,6 @@
["Variable_name"]=>
string(10) "Ssl_cipher"
["Value"]=>
- string(%d) "%s"
+ string(%d) "%S"
}
done!
Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -38,8 +38,15 @@
$max_len = pow(2, 24);
if ($org_max_allowed_packet < $max_len) {
- if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100)))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
+ if (1227 == mysqli_errno($link)) {
+ /* [1227] Access denied; you need the SUPER privilege for this operation */
+ print "done!";
+ exit(0);
+ } else {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
}
mysqli_close($link);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
@@ -94,7 +101,8 @@
}
if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1227 != mysqli_errno($link))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt 2010-05-27 12:05:02 UTC (rev 299844)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt 2010-05-27 12:09:39 UTC (rev 299845)
@@ -22,14 +22,22 @@
require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ 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);
exit(1);
}
+ $cols = 2500;
+
list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
- printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1227 == mysqli_errno($link)) {
+ /* [1227] Access denied; you need the SUPER privilege for this operation */
+ $cols = 10;
+ } else {
+ $cols = 10;
+ printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
}
mysqli_close($link);
@@ -40,22 +48,21 @@
exit(1);
}
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
exit(1);
}
- $cols = 2500;
$str = array();
for ($i = 1; $i <= $cols; $i++) {
$str[] ="a$i BLOB";
}
- $link->query("CREATE TABLE ps_test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
+ $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
if (mysqli_errno($link)) {
printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
die("");
}
- $stmt = $link->prepare("INSERT INTO ps_test VALUES(".str_repeat("?, ", $cols-1) . "?)");
+ $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
var_dump($stmt->id);
$s = str_repeat("a", 2 << 12);
$eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
@@ -77,7 +84,8 @@
if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
- printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1227 != mysqli_errno($link))
+ printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysqli_close($link);
@@ -86,15 +94,7 @@
?>
--CLEAN--
<?php
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
- printf("Failed to drop the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- exit(1);
- }
+ require_once("clean_table.inc");
?>
--EXPECTF--
int(1)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php