From 19314ff8874e7c0a04a97acf342341938c0ffa6c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 17 Sep 2020 15:55:44 +0200 Subject: [PATCH] Fix some tests for libmysql --- ext/mysqli/tests/bug66043.phpt | 29 +++++++++++++++---- ext/mysqli/tests/bug73800.phpt | 1 + ext/mysqli/tests/bug77597.phpt | 1 + ...ysqli_class_mysqli_properties_no_conn.phpt | 4 +-- ext/mysqli/tests/mysqli_kill.phpt | 4 +-- .../tests/mysqli_store_result_buffered_c.phpt | 5 ++-- .../tests/pdo_mysql___construct_uri.phpt | 1 + .../tests/pdo_mysql_class_constants.phpt | 2 +- 8 files changed, 35 insertions(+), 12 deletions(-) diff --git a/ext/mysqli/tests/bug66043.phpt b/ext/mysqli/tests/bug66043.phpt index 07714f217a..6b479a45ed 100644 --- a/ext/mysqli/tests/bug66043.phpt +++ b/ext/mysqli/tests/bug66043.phpt @@ -3,10 +3,6 @@ Bug #66043 (Segfault calling bind_param() on mysqli) --SKIPIF-- --FILE-- @@ -16,11 +12,34 @@ if (!$db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); } +if (!$db->query("DROP TABLE IF EXISTS test")) { + printf("[002] [%d] %s\n", mysqli_errno($db), mysqli_error($db)); + die(); +} + +if (!$db->query("CREATE TABLE test(str TEXT)")) { + printf("[003] [%d] %s\n", mysqli_errno($db), mysqli_error($db)); + die(); +} + +if (!$db->query("INSERT INTO test(str) VALUES ('Test')")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + die(); +} + $stmt = $db->stmt_init(); -$stmt->prepare("SELECT User FROM user WHERE password=\"\""); +if (!$stmt->prepare("SELECT str FROM test")) { + printf("[004] [%d] %s\n", mysqli_errno($db), mysqli_error($db)); + die(); +} + $stmt->execute(); $stmt->bind_result($testArg); echo "Okey"; ?> +--CLEAN-- + --EXPECT-- Okey diff --git a/ext/mysqli/tests/bug73800.phpt b/ext/mysqli/tests/bug73800.phpt index af601c6e60..af3a5c8cfb 100644 --- a/ext/mysqli/tests/bug73800.phpt +++ b/ext/mysqli/tests/bug73800.phpt @@ -5,6 +5,7 @@ Bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE) require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); if (PHP_INT_SIZE != 8) die('skip requires 64-bit'); +if (!defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) die('skip requires mysqlnd'); ?> --FILE-- --FILE-- client_version = '80000'/integer +mysqli->client_version = '%d'/integer mysqli object is already closed mysqli object is already closed mysqli object is already closed @@ -366,7 +366,7 @@ Magic, magic properties: mysqli object is already closed Property access is not allowed yet Property access is not allowed yet -mysqli->client_version = '80000'/integer +mysqli->client_version = '%d'/integer mysqli object is already closed mysqli object is already closed mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt index d1301ac550..40ca9eaa1a 100644 --- a/ext/mysqli/tests/mysqli_kill.phpt +++ b/ext/mysqli/tests/mysqli_kill.phpt @@ -95,7 +95,7 @@ object(mysqli)#%d (%d) { ["connect_error"]=> NULL ["errno"]=> - int(2006) + int(%d) ["error"]=> string(%d) "%s" ["error_list"]=> @@ -103,7 +103,7 @@ object(mysqli)#%d (%d) { [0]=> array(3) { ["errno"]=> - int(2006) + int(%d) ["sqlstate"]=> string(5) "%s" ["error"]=> diff --git a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt index 6fa69005d2..70a864270d 100644 --- a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt +++ b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt @@ -4,9 +4,10 @@ mysqli_store_result() ---INI-- -mysqlnd.debug="d:t:O,{TMP}/mysqlnd.trace" --FILE-- true, "MYSQL_ATTR_COMPRESS" => true, "MYSQL_ATTR_MULTI_STATEMENTS" => true, - "MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true, ); if (!MySQLPDOTest::isPDOMySQLnd()) { @@ -37,6 +36,7 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) { } if (extension_loaded('mysqlnd')) { + $expected['MYSQL_ATTR_SSL_VERIFY_SERVER_CERT'] = true; $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; } else if (extension_loaded('mysqli')) { if (mysqli_get_client_version() > 50605) { -- 2.40.0