From 636d1b08033fd747ca591ee4bc79a19db9834245 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Wed, 10 Oct 2007 10:10:59 +0000 Subject: [PATCH] Further changes to regression/bug-verification tests. --- ext/mysqli/tests/bug28817.phpt | 15 +++++++++------ ext/mysqli/tests/bug29311.phpt | 33 ++++++++++++++++++--------------- ext/mysqli/tests/bug30967.phpt | 9 ++++++--- ext/mysqli/tests/bug31141.phpt | 4 ++-- ext/mysqli/tests/bug31668.phpt | 25 ++++++++++++++----------- ext/mysqli/tests/bug32405.phpt | 17 ++++++++++------- ext/mysqli/tests/bug33090.phpt | 9 ++++++--- ext/mysqli/tests/bug33263.phpt | 28 +++++++++++++++++----------- ext/mysqli/tests/bug33491.phpt | 9 ++++++--- ext/mysqli/tests/bug34785.phpt | 13 ++++++++----- ext/mysqli/tests/bug34810.phpt | 9 ++++++--- ext/mysqli/tests/bug35103.phpt | 7 +++++-- ext/mysqli/tests/bug35517.phpt | 15 +++++++++------ ext/mysqli/tests/bug35759.phpt | 7 +++++-- ext/mysqli/tests/bug36420.phpt | 7 +++++-- ext/mysqli/tests/bug36745.phpt | 9 ++++++--- ext/mysqli/tests/bug36802.phpt | 2 +- ext/mysqli/tests/bug36949.phpt | 14 ++++++++------ ext/mysqli/tests/bug37090.phpt | 11 +++++++++-- ext/mysqli/tests/bug38710.phpt | 7 ++++--- 20 files changed, 154 insertions(+), 96 deletions(-) diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt index a52cc6269b..e5fa7d563c 100644 --- a/ext/mysqli/tests/bug28817.phpt +++ b/ext/mysqli/tests/bug28817.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #28817 (problems with properties declared in the class extending MySQLi) --SKIPIF-- - + --FILE-- p_test); @var_dump($mysql->errno); - $mysql->connect($host, $user, $passwd); + $mysql->connect($host, $user, $passwd, $db, $port, $socket); $mysql->select_db("nonexistingdb"); var_dump($mysql->errno > 0); - $mysql->close(); + $mysql->close(); ?> --EXPECTF-- array(2) { [0]=> - string(3) "foo" + %s(3) "foo" [1]=> - string(3) "bar" + %s(3) "bar" } NULL -bool(true) +bool(true) \ No newline at end of file diff --git a/ext/mysqli/tests/bug29311.phpt b/ext/mysqli/tests/bug29311.phpt index b50de178b2..0c70f83557 100644 --- a/ext/mysqli/tests/bug29311.phpt +++ b/ext/mysqli/tests/bug29311.phpt @@ -1,48 +1,51 @@ --TEST-- constructor test --SKIPIF-- - + --FILE-- connect($host, $user, $passwd, "test"); + global $host, $user, $passwd, $db, $port, $socket; + $this->connect($host, $user, $passwd, $db, $port, $socket); } } /* class 3 has no constructor */ class mysql3 extends mysqli { - + } - $foo[0] = new mysql1(); - $foo[1] = new mysql2(); - $foo[2] = new mysql3($host, $user, $passwd, "test"); + $foo[0] = new mysql1(); + $foo[1] = new mysql2(); + $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket); for ($i=0; $i < 3; $i++) { if (($result = $foo[$i]->query("SELECT DATABASE()"))) { $row = $result->fetch_row(); - printf("%d: %s\n", $i, $row[0]); + if ($row[0] != $db) + printf("%d: %s\n", $i, $row[0]); $result->close(); } $foo[$i]->close(); } + print "done!"; ?> --EXPECTF-- -0: test -1: test -2: test +done! \ No newline at end of file diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt index 410764a779..8051acbdb3 100644 --- a/ext/mysqli/tests/bug30967.phpt +++ b/ext/mysqli/tests/bug30967.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #30967 (problems with properties declared in the class extending the class extending MySQLi) --SKIPIF-- - + --FILE-- query("THIS DOES NOT WORK"); printf("%d\n", $mysql->errno); - $mysql->close(); + $mysql->close(); ?> --EXPECTF-- 1064 diff --git a/ext/mysqli/tests/bug31141.phpt b/ext/mysqli/tests/bug31141.phpt index 3dc0dda1d5..71834742a9 100644 --- a/ext/mysqli/tests/bug31141.phpt +++ b/ext/mysqli/tests/bug31141.phpt @@ -22,7 +22,7 @@ var_dump($my_test->test); --EXPECTF-- array(2) { [0]=> - string(3) "foo" + %s(3) "foo" [1]=> - string(3) "bar" + %s(3) "bar" } diff --git a/ext/mysqli/tests/bug31668.phpt b/ext/mysqli/tests/bug31668.phpt index 6333030339..83636b142f 100644 --- a/ext/mysqli/tests/bug31668.phpt +++ b/ext/mysqli/tests/bug31668.phpt @@ -1,15 +1,18 @@ --TEST-- Bug #31668 (multi_query works exactly every other time (multi_query was global, now per connection)) --SKIPIF-- - + --FILE-- multi_query('SELECT 1;SELECT 2'); do { - $res = $mysql->store_result(); + $res = $mysql->store_result(); if ($mysql->errno == 0) { while ($arr = $res->fetch_assoc()) { var_dump($arr); @@ -20,10 +23,10 @@ Bug #31668 (multi_query works exactly every other time (multi_query was global, var_dump($mysql->error, __LINE__); $mysql->close(); - $mysql = new mysqli($host, $user, $passwd, "test"); + $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket); $mysql->multi_query('SELECT 1;SELECT 2'); do { - $res = $mysql->store_result(); + $res = $mysql->store_result(); if ($mysql->errno == 0) { while ($arr = $res->fetch_assoc()) { var_dump($arr); @@ -36,21 +39,21 @@ Bug #31668 (multi_query works exactly every other time (multi_query was global, --EXPECTF-- array(1) { [1]=> - string(1) "1" + %s(1) "1" } array(1) { [2]=> - string(1) "2" + %s(1) "2" } -string(0) "" +%s(0) "" int(%d) array(1) { [1]=> - string(1) "1" + %s(1) "1" } array(1) { [2]=> - string(1) "2" + %s(1) "2" } -string(0) "" +%s(0) "" int(%d) diff --git a/ext/mysqli/tests/bug32405.phpt b/ext/mysqli/tests/bug32405.phpt index 456a690483..7754f60a99 100644 --- a/ext/mysqli/tests/bug32405.phpt +++ b/ext/mysqli/tests/bug32405.phpt @@ -1,13 +1,16 @@ --TEST-- Bug #32405 (mysqli->fetch() is returning bad data) --SKIPIF-- - + --FILE-- fetch() is returning bad data) mysqli_query($link,"DROP TABLE test_users"); mysqli_close($link); ?> ---EXPECT-- +--EXPECTF-- int(1) -string(5) "user1" +%s(5) "user1" int(2) -string(5) "user2" +%s(5) "user2" int(3) -string(5) "user3" +%s(5) "user3" int(4) -string(5) "user4" +%s(5) "user4" diff --git a/ext/mysqli/tests/bug33090.phpt b/ext/mysqli/tests/bug33090.phpt index 5cda386e56..d7d5696981 100644 --- a/ext/mysqli/tests/bug33090.phpt +++ b/ext/mysqli/tests/bug33090.phpt @@ -1,14 +1,17 @@ --TEST-- Bug #33090 (mysql_prepare doesn't return an error) --SKIPIF-- - + --FILE-- prepare("this makes no sense"))) { printf("%d\n", $link->errno); diff --git a/ext/mysqli/tests/bug33263.phpt b/ext/mysqli/tests/bug33263.phpt index 55285ae89e..4f2a37c865 100644 --- a/ext/mysqli/tests/bug33263.phpt +++ b/ext/mysqli/tests/bug33263.phpt @@ -1,8 +1,11 @@ --TEST-- -Bug #33263 (mysqli_real_connect in __construct) +Bug #33263 (mysqli_real_connect in __construct) --SKIPIF-- - - + --FILE-- prepare("SELECT DATABASE()"); $stmt->execute(); - $stmt->bind_result($db); + $stmt->bind_result($database); $stmt->fetch(); $stmt->close(); - var_dump($db); + if ($database != $db) + printf("[001] Expecting '%s' got %s/'%s'.\n", + gettype($database), $database); - $mysql->close(); + $mysql->close(); + print "done!"; ?> ---EXPECT-- -string(4) "test" +--EXPECTF-- +done! \ No newline at end of file diff --git a/ext/mysqli/tests/bug33491.phpt b/ext/mysqli/tests/bug33491.phpt index 067e489aae..168ecb0381 100644 --- a/ext/mysqli/tests/bug33491.phpt +++ b/ext/mysqli/tests/bug33491.phpt @@ -3,7 +3,10 @@ Bug #33491 (extended mysqli class crashes when result is not object) --INI-- error_reporting=4095 --SKIPIF-- - + --FILE-- query_single('SELECT DATE()'); ?> diff --git a/ext/mysqli/tests/bug34785.phpt b/ext/mysqli/tests/bug34785.phpt index 3fe145a5f7..2130ccaf3a 100644 --- a/ext/mysqli/tests/bug34785.phpt +++ b/ext/mysqli/tests/bug34785.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #34785 (Can not properly subclass mysqli_stmt) --SKIPIF-- - + --FILE-- ---EXPECT-- -string(3) "foo" -string(3) "bar" +--EXPECTF-- +%s(3) "foo" +%s(3) "bar" diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt index 58a3bfb6d9..3bc959aab8 100644 --- a/ext/mysqli/tests/bug34810.phpt +++ b/ext/mysqli/tests/bug34810.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #34810 (mysqli::init() and others use wrong $this pointer without checks) --SKIPIF-- - + --FILE-- query("DROP TABLE IF EXISTS test_warnings"); $mysql->query("CREATE TABLE test_warnings (a int not null)"); $mysql->query("SET sql_mode=''"); diff --git a/ext/mysqli/tests/bug35103.phpt b/ext/mysqli/tests/bug35103.phpt index 19f7f30708..b94366203a 100644 --- a/ext/mysqli/tests/bug35103.phpt +++ b/ext/mysqli/tests/bug35103.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #35103 (Bad handling of unsigned bigint) --SKIPIF-- - + --FILE-- query("DROP TABLE IF EXISTS test_bint"); $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM"); $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)"); diff --git a/ext/mysqli/tests/bug35517.phpt b/ext/mysqli/tests/bug35517.phpt index 84f6e3ece8..9100ba919a 100644 --- a/ext/mysqli/tests/bug35517.phpt +++ b/ext/mysqli/tests/bug35517.phpt @@ -1,12 +1,15 @@ --TEST-- Bug #35517 (mysqli_stmt_fetch returns NULL) --SKIPIF-- - + --FILE-- query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)"); $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)"); @@ -23,7 +26,7 @@ Bug #35517 (mysqli_stmt_fetch returns NULL) $mysql->close(); ?> --EXPECTF-- -string(10) "3000000897" -string(10) "3800001532" -string(10) "3900002281" -string(10) "3100059612" +%s(10) "3000000897" +%s(10) "3800001532" +%s(10) "3900002281" +%s(10) "3100059612" diff --git a/ext/mysqli/tests/bug35759.phpt b/ext/mysqli/tests/bug35759.phpt index ce598427ac..b80ef1580d 100644 --- a/ext/mysqli/tests/bug35759.phpt +++ b/ext/mysqli/tests/bug35759.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #35759 (mysqli_stmt_bind_result() makes huge allocation when column empty) --SKIPIF-- - + --FILE-- query("DROP TABLE IF EXISTS blobby"); $create = "CREATE TABLE blobby (a0 MEDIUMBLOB NOT NULL DEFAULT ''"; $i= 0; diff --git a/ext/mysqli/tests/bug36420.phpt b/ext/mysqli/tests/bug36420.phpt index 921be8568b..49804e18ae 100644 --- a/ext/mysqli/tests/bug36420.phpt +++ b/ext/mysqli/tests/bug36420.phpt @@ -1,12 +1,15 @@ --TEST-- Bug #36420 (segfault when access result->num_rows after calling result->close()) --SKIPIF-- - + --FILE-- query('select 1'); diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt index 980dd893ea..eef65d8aae 100644 --- a/ext/mysqli/tests/bug36745.phpt +++ b/ext/mysqli/tests/bug36745.phpt @@ -1,13 +1,16 @@ --TEST-- Bug #36745 (LOAD DATA LOCAL INFILE doesn't return correct error message) --SKIPIF-- - + --FILE-- query("DROP TABLE IF EXISTS litest"); $mysql->query("CREATE TABLE litest (a VARCHAR(20))"); @@ -19,5 +22,5 @@ Bug #36745 (LOAD DATA LOCAL INFILE doesn't return correct error message) printf("Done"); ?> --EXPECTF-- -string(%d) "%s" +%s(%d) "%s" Done diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt index d3fa8b1229..b276a0a978 100644 --- a/ext/mysqli/tests/bug36802.phpt +++ b/ext/mysqli/tests/bug36802.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #36802 (crashes with mysql_init) +Bug #36802 (crashes with with mysqli_set_charset()) --SKIPIF-- --FILE-- diff --git a/ext/mysqli/tests/bug36949.phpt b/ext/mysqli/tests/bug36949.phpt index 9c7156a1f6..9362d7ff3a 100644 --- a/ext/mysqli/tests/bug36949.phpt +++ b/ext/mysqli/tests/bug36949.phpt @@ -1,18 +1,20 @@ --TEST-- Bug #36949 (invalid internal mysqli objects dtor) --SKIPIF-- - + --FILE-- mysqli = new mysqli($host, $user, $passwd); + global $user, $host, $passwd, $db, $port, $socket; + $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL"); $row = $result->fetch_object(); echo $row->my_time."
\n"; @@ -29,8 +31,8 @@ class B { private $mysqli; public function __construct() { - global $user, $host, $passwd; - $this->mysqli = new mysqli($host, $user, $passwd); + global $user, $host, $passwd, $db, $port, $socket; + $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket); $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL"); $row = $result->fetch_object(); echo $row->my_time."
\n"; diff --git a/ext/mysqli/tests/bug37090.phpt b/ext/mysqli/tests/bug37090.phpt index fa742495ea..651ba52b5b 100644 --- a/ext/mysqli/tests/bug37090.phpt +++ b/ext/mysqli/tests/bug37090.phpt @@ -1,16 +1,21 @@ --TEST-- Bug #37090 (mysqli_set_charset return code) --SKIPIF-- - --FILE-- set_charset("latin5"); @@ -23,6 +28,7 @@ if (!function_exists('mysqli_set_charset')) { $cs[] = $mysql->character_set_name(); var_dump($cs); + print "done!"; ?> --EXPECT-- array(6) { @@ -39,3 +45,4 @@ array(6) { [5]=> string(4) "utf8" } +done! \ No newline at end of file diff --git a/ext/mysqli/tests/bug38710.phpt b/ext/mysqli/tests/bug38710.phpt index b620568688..490810cbc7 100755 --- a/ext/mysqli/tests/bug38710.phpt +++ b/ext/mysqli/tests/bug38710.phpt @@ -3,21 +3,22 @@ Bug #38710 (data leakage because of nonexisting boundary checking in statements) --SKIPIF-- --FILE-- stmt_init(); $qry->prepare("SELECT REPEAT('a',100000)"); $qry->execute(); $qry->bind_result($text); $qry->fetch(); -if ($text !== str_repeat('a', mysqli_get_server_version($db) > 50110? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) { +if ($text !== str_repeat('a', ($IS_MYSQLND || mysqli_get_server_version($db) > 50110)? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) { var_dump(strlen($text)); } echo "Done"; ?> --EXPECTF-- -Done +Done \ No newline at end of file -- 2.50.1