Fix some tests for libmysql

This commit is contained in:
Nikita Popov 2020-09-17 15:55:44 +02:00
parent 2d002258b8
commit 19314ff887
8 changed files with 35 additions and 12 deletions

View file

@ -3,10 +3,6 @@ Bug #66043 (Segfault calling bind_param() on mysqli)
--SKIPIF-- --SKIPIF--
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once("connect.inc");
if ($IS_MYSQLND) {
die("skip libmysql only test");
}
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
?> ?>
--FILE-- --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()); 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 = $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->execute();
$stmt->bind_result($testArg); $stmt->bind_result($testArg);
echo "Okey"; echo "Okey";
?> ?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT-- --EXPECT--
Okey Okey

View file

@ -5,6 +5,7 @@ Bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE)
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
if (PHP_INT_SIZE != 8) die('skip requires 64-bit'); if (PHP_INT_SIZE != 8) die('skip requires 64-bit');
if (!defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) die('skip requires mysqlnd');
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -4,6 +4,7 @@ Bug #77597: mysqli_fetch_field hangs scripts
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -284,7 +284,7 @@ Magic, magic properties:
mysqli object is already closed mysqli object is already closed
Property access is not allowed yet Property access is not allowed yet
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 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 mysqli object is already closed
Property access is not allowed yet Property access is not allowed yet
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 mysqli object is already closed
mysqli object is already closed mysqli object is already closed

View file

@ -95,7 +95,7 @@ object(mysqli)#%d (%d) {
["connect_error"]=> ["connect_error"]=>
NULL NULL
["errno"]=> ["errno"]=>
int(2006) int(%d)
["error"]=> ["error"]=>
string(%d) "%s" string(%d) "%s"
["error_list"]=> ["error_list"]=>
@ -103,7 +103,7 @@ object(mysqli)#%d (%d) {
[0]=> [0]=>
array(3) { array(3) {
["errno"]=> ["errno"]=>
int(2006) int(%d)
["sqlstate"]=> ["sqlstate"]=>
string(5) "%s" string(5) "%s"
["error"]=> ["error"]=>

View file

@ -4,9 +4,10 @@ mysqli_store_result()
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) {
die("skip Requires MYSQLI_STORE_RESULT_COPY_DATA");
}
?> ?>
--INI--
mysqlnd.debug="d:t:O,{TMP}/mysqlnd.trace"
--FILE-- --FILE--
<?php <?php
require_once("connect.inc"); require_once("connect.inc");

View file

@ -48,6 +48,7 @@ MySQLPDOTest::skip();
} catch (PDOException $e) { } catch (PDOException $e) {
$expected = array( $expected = array(
"SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'", "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
"SQLSTATE[42000] [1049] Unknown database 'letshopeinvalid'",
"SQLSTATE[HY000] [2002] No such file or directory" "SQLSTATE[HY000] [2002] No such file or directory"
); );
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n", printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",

View file

@ -27,7 +27,6 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) {
"MYSQL_ATTR_SSL_CIPHER" => true, "MYSQL_ATTR_SSL_CIPHER" => true,
"MYSQL_ATTR_COMPRESS" => true, "MYSQL_ATTR_COMPRESS" => true,
"MYSQL_ATTR_MULTI_STATEMENTS" => true, "MYSQL_ATTR_MULTI_STATEMENTS" => true,
"MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true,
); );
if (!MySQLPDOTest::isPDOMySQLnd()) { if (!MySQLPDOTest::isPDOMySQLnd()) {
@ -37,6 +36,7 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) {
} }
if (extension_loaded('mysqlnd')) { if (extension_loaded('mysqlnd')) {
$expected['MYSQL_ATTR_SSL_VERIFY_SERVER_CERT'] = true;
$expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true; $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
} else if (extension_loaded('mysqli')) { } else if (extension_loaded('mysqli')) {
if (mysqli_get_client_version() > 50605) { if (mysqli_get_client_version() > 50605) {