summaryrefslogtreecommitdiff
path: root/ext/mysqli
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli')
-rw-r--r--ext/mysqli/mysqli.c112
-rw-r--r--ext/mysqli/mysqli.stub.php95
-rw-r--r--ext/mysqli/mysqli_api.c33
-rw-r--r--ext/mysqli/mysqli_arginfo.h343
-rw-r--r--ext/mysqli/mysqli_driver.c87
-rw-r--r--ext/mysqli/mysqli_nonapi.c48
-rw-r--r--ext/mysqli/mysqli_priv.h4
-rw-r--r--ext/mysqli/mysqli_prop.c171
-rw-r--r--ext/mysqli/mysqli_warning.c10
-rw-r--r--ext/mysqli/php_mysqli_structs.h31
-rw-r--r--ext/mysqli/tests/003.phpt2
-rw-r--r--ext/mysqli/tests/020.phpt2
-rw-r--r--ext/mysqli/tests/073.phpt22
-rw-r--r--ext/mysqli/tests/bug34810.phpt5
-rw-r--r--ext/mysqli/tests/bug62885.phpt4
-rw-r--r--ext/mysqli/tests/bug66124.phpt14
-rw-r--r--ext/mysqli/tests/bug75018.phpt6
-rw-r--r--ext/mysqli/tests/bug75434.phpt1
-rw-r--r--ext/mysqli/tests/bug77597.phpt12
-rw-r--r--ext/mysqli/tests/bug77935.phpt7
-rw-r--r--ext/mysqli/tests/bug77956.phpt5
-rw-r--r--ext/mysqli/tests/connect.inc5
-rw-r--r--ext/mysqli/tests/foo/bar/bar.data3
-rw-r--r--ext/mysqli/tests/foo/foo.data3
-rw-r--r--ext/mysqli/tests/local_infile_tools.inc12
-rw-r--r--ext/mysqli/tests/mysqli_allow_local_infile_overrides_local_infile_directory.phpt75
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt138
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_interface.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt50
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_constants.phpt5
-rw-r--r--ext/mysqli/tests/mysqli_driver.phpt180
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all_oo.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_oo.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_fetch_fields.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_incomplete_initialization.phpt1
-rw-r--r--ext/mysqli/tests/mysqli_insert_packet_overflow.phpt7
-rw-r--r--ext/mysqli/tests/mysqli_kill.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_local_infile_default_off.phpt4
-rw-r--r--ext/mysqli/tests/mysqli_local_infile_directory_access_allowed.phpt80
-rw-r--r--ext/mysqli/tests/mysqli_local_infile_directory_access_denied.phpt65
-rw-r--r--ext/mysqli/tests/mysqli_local_infile_directory_vs_open_basedir.phpt65
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt11
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt11
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt11
-rw-r--r--ext/mysqli/tests/mysqli_phpinfo.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_query_unicode.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_real_connect.phpt2
-rw-r--r--ext/mysqli/tests/mysqli_result_references.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_set.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_stmt_multires.phpt8
-rw-r--r--ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt7
59 files changed, 1277 insertions, 681 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 928ef8ea76..85847e7a3b 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -70,7 +70,7 @@ zend_class_entry *mysqli_warning_class_entry;
zend_class_entry *mysqli_exception_class_entry;
-typedef int (*mysqli_read_t)(mysqli_object *obj, zval *rv, zend_bool quiet);
+typedef int (*mysqli_read_t)(mysqli_object *obj, zval *rv, bool quiet);
typedef int (*mysqli_write_t)(mysqli_object *obj, zval *newval);
typedef struct _mysqli_prop_handler {
@@ -277,7 +277,7 @@ static void mysqli_warning_free_storage(zend_object *object)
/* }}} */
/* {{{ mysqli_read_na */
-static int mysqli_read_na(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int mysqli_read_na(mysqli_object *obj, zval *retval, bool quiet)
{
if (!quiet) {
zend_throw_error(NULL, "Cannot read property");
@@ -499,6 +499,7 @@ PHP_INI_BEGIN()
#endif
STD_PHP_INI_BOOLEAN("mysqli.reconnect", "0", PHP_INI_SYSTEM, OnUpdateLong, reconnect, zend_mysqli_globals, mysqli_globals)
STD_PHP_INI_BOOLEAN("mysqli.allow_local_infile", "0", PHP_INI_SYSTEM, OnUpdateLong, allow_local_infile, zend_mysqli_globals, mysqli_globals)
+ STD_PHP_INI_ENTRY("mysqli.local_infile_directory", NULL, PHP_INI_SYSTEM, OnUpdateString, local_infile_directory, zend_mysqli_globals, mysqli_globals)
PHP_INI_END()
/* }}} */
@@ -509,9 +510,9 @@ static PHP_GINIT_FUNCTION(mysqli)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
mysqli_globals->num_links = 0;
+ mysqli_globals->max_links = -1;
mysqli_globals->num_active_persistent = 0;
mysqli_globals->num_inactive_persistent = 0;
- mysqli_globals->max_links = -1;
mysqli_globals->max_persistent = -1;
mysqli_globals->allow_persistent = 1;
mysqli_globals->default_port = 0;
@@ -520,9 +521,9 @@ static PHP_GINIT_FUNCTION(mysqli)
mysqli_globals->default_pw = NULL;
mysqli_globals->default_socket = NULL;
mysqli_globals->reconnect = 0;
- mysqli_globals->report_mode = 0;
- mysqli_globals->report_ht = 0;
+ mysqli_globals->report_mode = MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT;;
mysqli_globals->allow_local_infile = 0;
+ mysqli_globals->local_infile_directory = NULL;
mysqli_globals->rollback_on_cached_plink = FALSE;
}
/* }}} */
@@ -530,8 +531,6 @@ static PHP_GINIT_FUNCTION(mysqli)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(mysqli)
{
- zend_class_entry *ce,cex;
-
REGISTER_INI_ENTRIES();
#ifndef MYSQLI_USE_MYSQLND
if (mysql_server_init(0, NULL, NULL)) {
@@ -564,99 +563,54 @@ PHP_MINIT_FUNCTION(mysqli)
le_pmysqli = zend_register_list_destructors_ex(NULL, php_mysqli_dtor,
"MySqli persistent connection", module_number);
- INIT_CLASS_ENTRY(cex, "mysqli_sql_exception", class_mysqli_sql_exception_methods);
- mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException);
- mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
- zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED);
- zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED);
+ mysqli_exception_class_entry = register_class_mysqli_sql_exception(spl_ce_RuntimeException);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_driver", mysqli_driver_class_entry, class_mysqli_driver_methods);
- ce = mysqli_driver_class_entry;
+ mysqli_driver_class_entry = register_class_mysqli_driver();
+ mysqli_driver_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_driver_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_driver_properties, mysqli_driver_property_entries);
- zend_declare_property_null(ce, "client_info", sizeof("client_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "client_version", sizeof("client_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "driver_version", sizeof("driver_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "reconnect", sizeof("reconnect") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "report_mode", sizeof("report_mode") - 1, ZEND_ACC_PUBLIC);
- ce->ce_flags |= ZEND_ACC_FINAL;
- zend_hash_add_ptr(&classes, ce->name, &mysqli_driver_properties);
-
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, class_mysqli_methods);
- ce = mysqli_link_class_entry;
+ zend_hash_add_ptr(&classes, mysqli_driver_class_entry->name, &mysqli_driver_properties);
+
+ mysqli_link_class_entry = register_class_mysqli();
+ mysqli_link_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_link_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_link_properties, mysqli_link_property_entries);
- zend_declare_property_null(ce, "affected_rows", sizeof("affected_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "client_info", sizeof("client_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "client_version", sizeof("client_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "connect_errno", sizeof("connect_errno") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "connect_error", sizeof("connect_error") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "errno", sizeof("errno") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error", sizeof("error") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error_list", sizeof("error_list") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "field_count", sizeof("field_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "host_info", sizeof("host_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "info", sizeof("info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "insert_id", sizeof("insert_id") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "server_info", sizeof("server_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "server_version", sizeof("server_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "protocol_version", sizeof("protocol_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "thread_id", sizeof("thread_id") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "warning_count", sizeof("warning_count") - 1, ZEND_ACC_PUBLIC);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_link_properties);
-
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, class_mysqli_warning_methods);
- ce = mysqli_warning_class_entry;
- ce->ce_flags |= ZEND_ACC_FINAL;
+ zend_hash_add_ptr(&classes, mysqli_link_class_entry->name, &mysqli_link_properties);
+
+ mysqli_warning_class_entry = register_class_mysqli_warning();
+ mysqli_warning_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_warning_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries);
- zend_declare_property_null(ce, "message", sizeof("message") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "errno", sizeof("errno") - 1, ZEND_ACC_PUBLIC);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_warning_properties);
+ zend_hash_add_ptr(&classes, mysqli_warning_class_entry->name, &mysqli_warning_properties);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, class_mysqli_result_methods);
- ce = mysqli_result_class_entry;
+ mysqli_result_class_entry = register_class_mysqli_result(zend_ce_aggregate);
+ mysqli_result_class_entry->create_object = mysqli_objects_new;
+ mysqli_result_class_entry->get_iterator = php_mysqli_result_get_iterator;
zend_hash_init(&mysqli_result_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_result_properties, mysqli_result_property_entries);
- zend_declare_property_null(ce, "current_field", sizeof("current_field") - 1,ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "field_count", sizeof("field_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "lengths", sizeof("lengths") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "num_rows", sizeof("num_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "type", sizeof("type") - 1, ZEND_ACC_PUBLIC);
- mysqli_result_class_entry->get_iterator = php_mysqli_result_get_iterator;
- zend_class_implements(mysqli_result_class_entry, 1, zend_ce_aggregate);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_result_properties);
+ zend_hash_add_ptr(&classes, mysqli_result_class_entry->name, &mysqli_result_properties);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, class_mysqli_stmt_methods);
- ce = mysqli_stmt_class_entry;
+ mysqli_stmt_class_entry = register_class_mysqli_stmt();
+ mysqli_stmt_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_stmt_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_stmt_properties, mysqli_stmt_property_entries);
- zend_declare_property_null(ce, "affected_rows", sizeof("affected_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "insert_id", sizeof("insert_id") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "num_rows", sizeof("num_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "param_count", sizeof("param_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "field_count", sizeof("field_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "errno", sizeof("errno") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error", sizeof("error") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error_list", sizeof("error_list") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "id", sizeof("id") - 1, ZEND_ACC_PUBLIC);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_stmt_properties);
+ zend_hash_add_ptr(&classes, mysqli_stmt_class_entry->name, &mysqli_stmt_properties);
/* mysqli_options */
REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT);
+#if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOAD_DATA_LOCAL_DIR", MYSQL_OPT_LOAD_DATA_LOCAL_DIR, CONST_CS | CONST_PERSISTENT);
+#endif
REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_OPT_READ_TIMEOUT", MYSQL_OPT_READ_TIMEOUT, CONST_CS | CONST_PERSISTENT);
#ifdef MYSQLI_USE_MYSQLND
REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT);
#endif
-#ifdef MYSQLND_STRING_TO_INT_CONVERSION
+#ifdef MYSQLI_USE_MYSQLND
REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID < 80000 || MYSQL_VERSION_ID >= 100000 || defined(MYSQLI_USE_MYSQLND)
@@ -805,6 +759,8 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_REPLICA", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT);
+ /* temporarily for backward compatibility */
REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT);
#ifdef REFRESH_BACKUP_LOG
@@ -870,7 +826,7 @@ PHP_RINIT_FUNCTION(mysqli)
#endif
MyG(error_msg) = NULL;
MyG(error_no) = 0;
- MyG(report_mode) = 0;
+ MyG(report_mode) = MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT;
return SUCCESS;
}
@@ -1069,7 +1025,7 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
MYSQL_ROW row;
unsigned int i, num_fields;
MYSQL_FIELD *fields;
- zend_ulong *field_len;
+ unsigned long *field_len;
if (!(row = mysql_fetch_row(result))) {
RETURN_NULL();
@@ -1130,7 +1086,7 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
}
}
#else
- mysqlnd_fetch_into(result, ((fetchtype & MYSQLI_NUM)? MYSQLND_FETCH_NUM:0) | ((fetchtype & MYSQLI_ASSOC)? MYSQLND_FETCH_ASSOC:0), return_value, MYSQLND_MYSQLI);
+ mysqlnd_fetch_into(result, ((fetchtype & MYSQLI_NUM)? MYSQLND_FETCH_NUM:0) | ((fetchtype & MYSQLI_ASSOC)? MYSQLND_FETCH_ASSOC:0), return_value);
#endif
}
/* }}} */
diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php
index 9326bbd915..9956778c6e 100644
--- a/ext/mysqli/mysqli.stub.php
+++ b/ext/mysqli/mysqli.stub.php
@@ -1,13 +1,60 @@
<?php
-/** @generate-function-entries */
+/** @generate-class-entries */
final class mysqli_driver
{
+ public string $client_info;
+
+ public int $client_version;
+
+ public int $driver_version;
+
+ /** @var bool */
+ public $reconnect = false;
+
+ /** @var int */
+ public $report_mode = 0;
}
class mysqli
{
+ public int|string $affected_rows;
+
+ public string $client_info;
+
+ public int $client_version;
+
+ public int $connect_errno;
+
+ public ?string $connect_error;
+
+ public int $errno;
+
+ public string $error;
+
+ public array $error_list;
+
+ public int $field_count;
+
+ public string $host_info;
+
+ public ?string $info;
+
+ public int|string $insert_id;
+
+ public string $server_info;
+
+ public int $server_version;
+
+ public string $sqlstate;
+
+ public int $protocol_version;
+
+ public int $thread_id;
+
+ public int $warning_count;
+
public function __construct(
?string $hostname = null,
?string $username = null,
@@ -302,6 +349,16 @@ class mysqli
class mysqli_result implements IteratorAggregate
{
+ public int $current_field;
+
+ public int $field_count;
+
+ public ?array $lengths;
+
+ public int|string $num_rows;
+
+ public int $type;
+
public function __construct(mysqli $mysql, int $result_mode = MYSQLI_STORE_RESULT) {}
/**
@@ -340,13 +397,11 @@ class mysqli_result implements IteratorAggregate
*/
public function fetch_field_direct(int $index) {}
-#if defined(MYSQLI_USE_MYSQLND)
/**
* @return array
* @alias mysqli_fetch_all
*/
public function fetch_all(int $mode = MYSQLI_NUM) {}
-#endif
/**
* @return array|null|false
@@ -389,6 +444,26 @@ class mysqli_result implements IteratorAggregate
class mysqli_stmt
{
+ public int|string $affected_rows;
+
+ public int|string $insert_id;
+
+ public int|string $num_rows;
+
+ public int $param_count;
+
+ public int $field_count;
+
+ public int $errno;
+
+ public string $error;
+
+ public array $error_list;
+
+ public string $sqlstate;
+
+ public int $id;
+
public function __construct(mysqli $mysql, ?string $query = null) {}
/**
@@ -457,13 +532,13 @@ class mysqli_stmt
* @alias mysqli_stmt_more_results
*/
public function more_results() {}
+#endif
/**
* @return bool
* @alias mysqli_stmt_next_result
*/
public function next_result() {}
-#endif
/**
* @return int|string
@@ -512,6 +587,12 @@ class mysqli_stmt
final class mysqli_warning
{
+ public string $message;
+
+ public string $sqlstate;
+
+ public int $errno;
+
private function __construct() {}
public function next(): bool {}
@@ -519,6 +600,8 @@ final class mysqli_warning
final class mysqli_sql_exception extends RuntimeException
{
+ /** @var string */
+ protected $sqlstate = "00000";
}
function mysqli_affected_rows(mysqli $mysql): int|string {}
@@ -573,9 +656,7 @@ function mysqli_fetch_field_direct(mysqli_result $result, int $index): object|fa
function mysqli_fetch_lengths(mysqli_result $result): array|false {}
-#if defined(MYSQLI_USE_MYSQLND)
function mysqli_fetch_all(mysqli_result $result, int $mode = MYSQLI_NUM): array {}
-#endif
function mysqli_fetch_array(mysqli_result $result, int $mode = MYSQLI_BOTH): array|null|false {}
@@ -726,9 +807,9 @@ function mysqli_stmt_insert_id(mysqli_stmt $statement): int|string {}
#if defined(MYSQLI_USE_MYSQLND)
function mysqli_stmt_more_results(mysqli_stmt $statement): bool {}
+#endif
function mysqli_stmt_next_result(mysqli_stmt $statement): bool {}
-#endif
function mysqli_stmt_num_rows(mysqli_stmt $statement): int|string {}
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index e8f25c310a..e1abd07135 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -71,7 +71,7 @@ mysqli_escape_string_for_tx_name_in_comment(const char * const name)
{
char * ret = NULL;
if (name) {
- zend_bool warned = FALSE;
+ bool warned = FALSE;
const char * p_orig = name;
char * p_copy;
p_copy = ret = emalloc(strlen(name) + 1 + 2 + 2 + 1); /* space, open, close, NullS */
@@ -107,7 +107,7 @@ mysqli_escape_string_for_tx_name_in_comment(const char * const name)
/* }}} */
/* {{{ mysqli_commit_or_rollback_libmysql */
-static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const uint32_t mode, const char * const name)
+static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, bool commit, const uint32_t mode, const char * const name)
{
int ret;
smart_str tmp_str = {0};
@@ -161,7 +161,7 @@ PHP_FUNCTION(mysqli_autocommit)
{
MY_MYSQL *mysql;
zval *mysql_link;
- zend_bool automode;
+ bool automode;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) {
RETURN_THROWS();
@@ -858,12 +858,12 @@ PHP_FUNCTION(mysqli_stmt_execute)
stmt->stmt->params[i].buffer_length = Z_STRLEN_P(param);
break;
case MYSQL_TYPE_DOUBLE:
- convert_to_double_ex(param);
+ convert_to_double(param);
stmt->stmt->params[i].buffer = &Z_DVAL_P(param);
break;
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_LONG:
- convert_to_long_ex(param);
+ convert_to_long(param);
stmt->stmt->params[i].buffer = &Z_LVAL_P(param);
break;
default:
@@ -1057,7 +1057,7 @@ void mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAMETERS)
{
MY_STMT *stmt;
zval *mysql_stmt;
- zend_bool fetched_anything;
+ bool fetched_anything;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
RETURN_THROWS();
@@ -1108,7 +1108,7 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field)
*/
add_property_string(value, "catalog", "def");
- add_property_long(value, "max_length", field->max_length);
+ add_property_long(value, "max_length", 0);
add_property_long(value, "length", field->length);
add_property_long(value, "charsetnr", field->charsetnr);
add_property_long(value, "flags", field->flags);
@@ -1210,7 +1210,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
#ifdef MYSQLI_USE_MYSQLND
const size_t *ret;
#else
- const zend_ulong *ret;
+ const unsigned long *ret;
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
@@ -1426,7 +1426,7 @@ PHP_FUNCTION(mysqli_info)
/* }}} */
/* {{{ php_mysqli_init() */
-void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_method)
+void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, bool is_method)
{
MYSQLI_RESOURCE *mysqli_resource;
MY_MYSQL *mysql;
@@ -1448,7 +1448,7 @@ void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_method)
We create always persistent, as if the user want to connect
to p:somehost, we can't convert the handle then
*/
- if (!(mysql->mysql = mysqlnd_init(MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA, TRUE)))
+ if (!(mysql->mysql = mysqlnd_init(MYSQLND_CLIENT_NO_FLAG, TRUE)))
#endif
{
efree(mysql);
@@ -1565,6 +1565,7 @@ PHP_FUNCTION(mysqli_stmt_more_results)
RETURN_BOOL(mysqlnd_stmt_more_results(stmt->stmt));
}
/* }}} */
+#endif
/* {{{ read next result from multi_query */
PHP_FUNCTION(mysqli_stmt_next_result) {
@@ -1583,7 +1584,6 @@ PHP_FUNCTION(mysqli_stmt_next_result) {
RETURN_TRUE;
}
/* }}} */
-#endif
/* {{{ Get number of fields in result */
PHP_FUNCTION(mysqli_num_fields)
@@ -1627,9 +1627,7 @@ static int mysqli_options_get_option_zval_type(int option)
#ifdef MYSQLI_USE_MYSQLND
case MYSQLND_OPT_NET_CMD_BUFFER_SIZE:
case MYSQLND_OPT_NET_READ_BUFFER_SIZE:
-#ifdef MYSQLND_STRING_TO_INT_CONVERSION
case MYSQLND_OPT_INT_AND_FLOAT_NATIVE:
-#endif
#endif /* MYSQLI_USE_MYSQLND */
case MYSQL_OPT_CONNECT_TIMEOUT:
#ifdef MYSQL_REPORT_DATA_TRUNCATION
@@ -1676,6 +1674,9 @@ static int mysqli_options_get_option_zval_type(int option)
#if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND)
case MYSQL_SERVER_PUBLIC_KEY:
#endif
+#if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)
+ case MYSQL_OPT_LOAD_DATA_LOCAL_DIR:
+#endif
return IS_STRING;
default:
@@ -1716,7 +1717,7 @@ PHP_FUNCTION(mysqli_options)
}
break;
case IS_LONG:
- convert_to_long_ex(mysql_value);
+ convert_to_long(mysql_value);
break;
default:
break;
@@ -2506,11 +2507,7 @@ PHP_FUNCTION(mysqli_store_result)
RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
-#ifdef MYSQLI_USE_MYSQLND
- result = flags & MYSQLI_STORE_RESULT_COPY_DATA? mysqlnd_store_result_ofs(mysql->mysql) : mysqlnd_store_result(mysql->mysql);
-#else
result = mysql_store_result(mysql->mysql);
-#endif
if (!result) {
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
RETURN_FALSE;
diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h
index c9f203a559..9c55a6bfc8 100644
--- a/ext/mysqli/mysqli_arginfo.h
+++ b/ext/mysqli/mysqli_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 36c7ee22aa4c5bb5e0174031a3defcaaadde0dbd */
+ * Stub hash: 56499df713b79c1e9efc19cf8be45aa98028172c */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
@@ -92,12 +92,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_fetch_lengths, 0, 1, MAY_
ZEND_ARG_OBJ_INFO(0, result, mysqli_result, 0)
ZEND_END_ARG_INFO()
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_fetch_all, 0, 1, IS_ARRAY, 0)
ZEND_ARG_OBJ_INFO(0, result, mysqli_result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "MYSQLI_NUM")
ZEND_END_ARG_INFO()
-#endif
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_fetch_array, 0, 1, MAY_BE_ARRAY|MAY_BE_NULL|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, result, mysqli_result, 0)
@@ -353,9 +351,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_stmt_more_results, 0, 1,
ZEND_END_ARG_INFO()
#endif
-#if defined(MYSQLI_USE_MYSQLND)
-#define arginfo_mysqli_stmt_next_result arginfo_mysqli_stmt_more_results
-#endif
+#define arginfo_mysqli_stmt_next_result arginfo_mysqli_stmt_execute
#define arginfo_mysqli_stmt_num_rows arginfo_mysqli_stmt_affected_rows
@@ -593,11 +589,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_result_fetch_field_direct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_result_fetch_all, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "MYSQLI_NUM")
ZEND_END_ARG_INFO()
-#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_result_fetch_array, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "MYSQLI_BOTH")
@@ -658,9 +652,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_mysqli_stmt_more_results arginfo_class_mysqli_get_connection_stats
#endif
-#if defined(MYSQLI_USE_MYSQLND)
-#define arginfo_class_mysqli_stmt_next_result arginfo_class_mysqli_get_connection_stats
-#endif
+#define arginfo_class_mysqli_stmt_next_result arginfo_class_mysqli_character_set_name
#define arginfo_class_mysqli_stmt_num_rows arginfo_class_mysqli_character_set_name
@@ -707,9 +699,7 @@ ZEND_FUNCTION(mysqli_fetch_field);
ZEND_FUNCTION(mysqli_fetch_fields);
ZEND_FUNCTION(mysqli_fetch_field_direct);
ZEND_FUNCTION(mysqli_fetch_lengths);
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_FUNCTION(mysqli_fetch_all);
-#endif
ZEND_FUNCTION(mysqli_fetch_array);
ZEND_FUNCTION(mysqli_fetch_assoc);
ZEND_FUNCTION(mysqli_fetch_object);
@@ -783,9 +773,7 @@ ZEND_FUNCTION(mysqli_stmt_insert_id);
#if defined(MYSQLI_USE_MYSQLND)
ZEND_FUNCTION(mysqli_stmt_more_results);
#endif
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_FUNCTION(mysqli_stmt_next_result);
-#endif
ZEND_FUNCTION(mysqli_stmt_num_rows);
ZEND_FUNCTION(mysqli_stmt_param_count);
ZEND_FUNCTION(mysqli_stmt_prepare);
@@ -835,9 +823,7 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(mysqli_fetch_fields, arginfo_mysqli_fetch_fields)
ZEND_FE(mysqli_fetch_field_direct, arginfo_mysqli_fetch_field_direct)
ZEND_FE(mysqli_fetch_lengths, arginfo_mysqli_fetch_lengths)
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_FE(mysqli_fetch_all, arginfo_mysqli_fetch_all)
-#endif
ZEND_FE(mysqli_fetch_array, arginfo_mysqli_fetch_array)
ZEND_FE(mysqli_fetch_assoc, arginfo_mysqli_fetch_assoc)
ZEND_FE(mysqli_fetch_object, arginfo_mysqli_fetch_object)
@@ -913,9 +899,7 @@ static const zend_function_entry ext_functions[] = {
#if defined(MYSQLI_USE_MYSQLND)
ZEND_FE(mysqli_stmt_more_results, arginfo_mysqli_stmt_more_results)
#endif
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_FE(mysqli_stmt_next_result, arginfo_mysqli_stmt_next_result)
-#endif
ZEND_FE(mysqli_stmt_num_rows, arginfo_mysqli_stmt_num_rows)
ZEND_FE(mysqli_stmt_param_count, arginfo_mysqli_stmt_param_count)
ZEND_FE(mysqli_stmt_prepare, arginfo_mysqli_stmt_prepare)
@@ -1004,9 +988,7 @@ static const zend_function_entry class_mysqli_result_methods[] = {
ZEND_ME_MAPPING(fetch_field, mysqli_fetch_field, arginfo_class_mysqli_result_fetch_field, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(fetch_fields, mysqli_fetch_fields, arginfo_class_mysqli_result_fetch_fields, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(fetch_field_direct, mysqli_fetch_field_direct, arginfo_class_mysqli_result_fetch_field_direct, ZEND_ACC_PUBLIC)
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_ME_MAPPING(fetch_all, mysqli_fetch_all, arginfo_class_mysqli_result_fetch_all, ZEND_ACC_PUBLIC)
-#endif
ZEND_ME_MAPPING(fetch_array, mysqli_fetch_array, arginfo_class_mysqli_result_fetch_array, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(fetch_assoc, mysqli_fetch_assoc, arginfo_class_mysqli_result_fetch_assoc, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(fetch_object, mysqli_fetch_object, arginfo_class_mysqli_result_fetch_object, ZEND_ACC_PUBLIC)
@@ -1033,9 +1015,7 @@ static const zend_function_entry class_mysqli_stmt_methods[] = {
#if defined(MYSQLI_USE_MYSQLND)
ZEND_ME_MAPPING(more_results, mysqli_stmt_more_results, arginfo_class_mysqli_stmt_more_results, ZEND_ACC_PUBLIC)
#endif
-#if defined(MYSQLI_USE_MYSQLND)
ZEND_ME_MAPPING(next_result, mysqli_stmt_next_result, arginfo_class_mysqli_stmt_next_result, ZEND_ACC_PUBLIC)
-#endif
ZEND_ME_MAPPING(num_rows, mysqli_stmt_num_rows, arginfo_class_mysqli_stmt_num_rows, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(send_long_data, mysqli_stmt_send_long_data, arginfo_class_mysqli_stmt_send_long_data, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(free_result, mysqli_stmt_free_result, arginfo_class_mysqli_stmt_free_result, ZEND_ACC_PUBLIC)
@@ -1059,3 +1039,320 @@ static const zend_function_entry class_mysqli_warning_methods[] = {
static const zend_function_entry class_mysqli_sql_exception_methods[] = {
ZEND_FE_END
};
+
+static zend_class_entry *register_class_mysqli_driver(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_driver", class_mysqli_driver_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ zval property_client_info_default_value;
+ ZVAL_UNDEF(&property_client_info_default_value);
+ zend_string *property_client_info_name = zend_string_init("client_info", sizeof("client_info") - 1, 1);
+ zend_declare_typed_property(class_entry, property_client_info_name, &property_client_info_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_client_info_name);
+
+ zval property_client_version_default_value;
+ ZVAL_UNDEF(&property_client_version_default_value);
+ zend_string *property_client_version_name = zend_string_init("client_version", sizeof("client_version") - 1, 1);
+ zend_declare_typed_property(class_entry, property_client_version_name, &property_client_version_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_client_version_name);
+
+ zval property_driver_version_default_value;
+ ZVAL_UNDEF(&property_driver_version_default_value);
+ zend_string *property_driver_version_name = zend_string_init("driver_version", sizeof("driver_version") - 1, 1);
+ zend_declare_typed_property(class_entry, property_driver_version_name, &property_driver_version_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_driver_version_name);
+
+ zval property_reconnect_default_value;
+ ZVAL_BOOL(&property_reconnect_default_value, 0);
+ zend_string *property_reconnect_name = zend_string_init("reconnect", sizeof("reconnect") - 1, 1);
+ zend_declare_property_ex(class_entry, property_reconnect_name, &property_reconnect_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_reconnect_name);
+
+ zval property_report_mode_default_value;
+ ZVAL_LONG(&property_report_mode_default_value, 0);
+ zend_string *property_report_mode_name = zend_string_init("report_mode", sizeof("report_mode") - 1, 1);
+ zend_declare_property_ex(class_entry, property_report_mode_name, &property_report_mode_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_report_mode_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli", class_mysqli_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_affected_rows_default_value;
+ ZVAL_UNDEF(&property_affected_rows_default_value);
+ zend_string *property_affected_rows_name = zend_string_init("affected_rows", sizeof("affected_rows") - 1, 1);
+ zend_declare_typed_property(class_entry, property_affected_rows_name, &property_affected_rows_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_STRING));
+ zend_string_release(property_affected_rows_name);
+
+ zval property_client_info_default_value;
+ ZVAL_UNDEF(&property_client_info_default_value);
+ zend_string *property_client_info_name = zend_string_init("client_info", sizeof("client_info") - 1, 1);
+ zend_declare_typed_property(class_entry, property_client_info_name, &property_client_info_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_client_info_name);
+
+ zval property_client_version_default_value;
+ ZVAL_UNDEF(&property_client_version_default_value);
+ zend_string *property_client_version_name = zend_string_init("client_version", sizeof("client_version") - 1, 1);
+ zend_declare_typed_property(class_entry, property_client_version_name, &property_client_version_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_client_version_name);
+
+ zval property_connect_errno_default_value;
+ ZVAL_UNDEF(&property_connect_errno_default_value);
+ zend_string *property_connect_errno_name = zend_string_init("connect_errno", sizeof("connect_errno") - 1, 1);
+ zend_declare_typed_property(class_entry, property_connect_errno_name, &property_connect_errno_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_connect_errno_name);
+
+ zval property_connect_error_default_value;
+ ZVAL_UNDEF(&property_connect_error_default_value);
+ zend_string *property_connect_error_name = zend_string_init("connect_error", sizeof("connect_error") - 1, 1);
+ zend_declare_typed_property(class_entry, property_connect_error_name, &property_connect_error_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
+ zend_string_release(property_connect_error_name);
+
+ zval property_errno_default_value;
+ ZVAL_UNDEF(&property_errno_default_value);
+ zend_string *property_errno_name = zend_string_init("errno", sizeof("errno") - 1, 1);
+ zend_declare_typed_property(class_entry, property_errno_name, &property_errno_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_errno_name);
+
+ zval property_error_default_value;
+ ZVAL_UNDEF(&property_error_default_value);
+ zend_string *property_error_name = zend_string_init("error", sizeof("error") - 1, 1);
+ zend_declare_typed_property(class_entry, property_error_name, &property_error_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_error_name);
+
+ zval property_error_list_default_value;
+ ZVAL_UNDEF(&property_error_list_default_value);
+ zend_string *property_error_list_name = zend_string_init("error_list", sizeof("error_list") - 1, 1);
+ zend_declare_typed_property(class_entry, property_error_list_name, &property_error_list_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY));
+ zend_string_release(property_error_list_name);
+
+ zval property_field_count_default_value;
+ ZVAL_UNDEF(&property_field_count_default_value);
+ zend_string *property_field_count_name = zend_string_init("field_count", sizeof("field_count") - 1, 1);
+ zend_declare_typed_property(class_entry, property_field_count_name, &property_field_count_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_field_count_name);
+
+ zval property_host_info_default_value;
+ ZVAL_UNDEF(&property_host_info_default_value);
+ zend_string *property_host_info_name = zend_string_init("host_info", sizeof("host_info") - 1, 1);
+ zend_declare_typed_property(class_entry, property_host_info_name, &property_host_info_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_host_info_name);
+
+ zval property_info_default_value;
+ ZVAL_UNDEF(&property_info_default_value);
+ zend_string *property_info_name = zend_string_init("info", sizeof("info") - 1, 1);
+ zend_declare_typed_property(class_entry, property_info_name, &property_info_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
+ zend_string_release(property_info_name);
+
+ zval property_insert_id_default_value;
+ ZVAL_UNDEF(&property_insert_id_default_value);
+ zend_string *property_insert_id_name = zend_string_init("insert_id", sizeof("insert_id") - 1, 1);
+ zend_declare_typed_property(class_entry, property_insert_id_name, &property_insert_id_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_STRING));
+ zend_string_release(property_insert_id_name);
+
+ zval property_server_info_default_value;
+ ZVAL_UNDEF(&property_server_info_default_value);
+ zend_string *property_server_info_name = zend_string_init("server_info", sizeof("server_info") - 1, 1);
+ zend_declare_typed_property(class_entry, property_server_info_name, &property_server_info_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_server_info_name);
+
+ zval property_server_version_default_value;
+ ZVAL_UNDEF(&property_server_version_default_value);
+ zend_string *property_server_version_name = zend_string_init("server_version", sizeof("server_version") - 1, 1);
+ zend_declare_typed_property(class_entry, property_server_version_name, &property_server_version_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_server_version_name);
+
+ zval property_sqlstate_default_value;
+ ZVAL_UNDEF(&property_sqlstate_default_value);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_typed_property(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_sqlstate_name);
+
+ zval property_protocol_version_default_value;
+ ZVAL_UNDEF(&property_protocol_version_default_value);
+ zend_string *property_protocol_version_name = zend_string_init("protocol_version", sizeof("protocol_version") - 1, 1);
+ zend_declare_typed_property(class_entry, property_protocol_version_name, &property_protocol_version_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_protocol_version_name);
+
+ zval property_thread_id_default_value;
+ ZVAL_UNDEF(&property_thread_id_default_value);
+ zend_string *property_thread_id_name = zend_string_init("thread_id", sizeof("thread_id") - 1, 1);
+ zend_declare_typed_property(class_entry, property_thread_id_name, &property_thread_id_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_thread_id_name);
+
+ zval property_warning_count_default_value;
+ ZVAL_UNDEF(&property_warning_count_default_value);
+ zend_string *property_warning_count_name = zend_string_init("warning_count", sizeof("warning_count") - 1, 1);
+ zend_declare_typed_property(class_entry, property_warning_count_name, &property_warning_count_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_warning_count_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_result(zend_class_entry *class_entry_IteratorAggregate)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_result", class_mysqli_result_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_IteratorAggregate);
+
+ zval property_current_field_default_value;
+ ZVAL_UNDEF(&property_current_field_default_value);
+ zend_string *property_current_field_name = zend_string_init("current_field", sizeof("current_field") - 1, 1);
+ zend_declare_typed_property(class_entry, property_current_field_name, &property_current_field_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_current_field_name);
+
+ zval property_field_count_default_value;
+ ZVAL_UNDEF(&property_field_count_default_value);
+ zend_string *property_field_count_name = zend_string_init("field_count", sizeof("field_count") - 1, 1);
+ zend_declare_typed_property(class_entry, property_field_count_name, &property_field_count_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_field_count_name);
+
+ zval property_lengths_default_value;
+ ZVAL_UNDEF(&property_lengths_default_value);
+ zend_string *property_lengths_name = zend_string_init("lengths", sizeof("lengths") - 1, 1);
+ zend_declare_typed_property(class_entry, property_lengths_name, &property_lengths_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY|MAY_BE_NULL));
+ zend_string_release(property_lengths_name);
+
+ zval property_num_rows_default_value;
+ ZVAL_UNDEF(&property_num_rows_default_value);
+ zend_string *property_num_rows_name = zend_string_init("num_rows", sizeof("num_rows") - 1, 1);
+ zend_declare_typed_property(class_entry, property_num_rows_name, &property_num_rows_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_STRING));
+ zend_string_release(property_num_rows_name);
+
+ zval property_type_default_value;
+ ZVAL_UNDEF(&property_type_default_value);
+ zend_string *property_type_name = zend_string_init("type", sizeof("type") - 1, 1);
+ zend_declare_typed_property(class_entry, property_type_name, &property_type_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_type_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_stmt(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_stmt", class_mysqli_stmt_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_affected_rows_default_value;
+ ZVAL_UNDEF(&property_affected_rows_default_value);
+ zend_string *property_affected_rows_name = zend_string_init("affected_rows", sizeof("affected_rows") - 1, 1);
+ zend_declare_typed_property(class_entry, property_affected_rows_name, &property_affected_rows_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_STRING));
+ zend_string_release(property_affected_rows_name);
+
+ zval property_insert_id_default_value;
+ ZVAL_UNDEF(&property_insert_id_default_value);
+ zend_string *property_insert_id_name = zend_string_init("insert_id", sizeof("insert_id") - 1, 1);
+ zend_declare_typed_property(class_entry, property_insert_id_name, &property_insert_id_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_STRING));
+ zend_string_release(property_insert_id_name);
+
+ zval property_num_rows_default_value;
+ ZVAL_UNDEF(&property_num_rows_default_value);
+ zend_string *property_num_rows_name = zend_string_init("num_rows", sizeof("num_rows") - 1, 1);
+ zend_declare_typed_property(class_entry, property_num_rows_name, &property_num_rows_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_STRING));
+ zend_string_release(property_num_rows_name);
+
+ zval property_param_count_default_value;
+ ZVAL_UNDEF(&property_param_count_default_value);
+ zend_string *property_param_count_name = zend_string_init("param_count", sizeof("param_count") - 1, 1);
+ zend_declare_typed_property(class_entry, property_param_count_name, &property_param_count_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_param_count_name);
+
+ zval property_field_count_default_value;
+ ZVAL_UNDEF(&property_field_count_default_value);
+ zend_string *property_field_count_name = zend_string_init("field_count", sizeof("field_count") - 1, 1);
+ zend_declare_typed_property(class_entry, property_field_count_name, &property_field_count_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_field_count_name);
+
+ zval property_errno_default_value;
+ ZVAL_UNDEF(&property_errno_default_value);
+ zend_string *property_errno_name = zend_string_init("errno", sizeof("errno") - 1, 1);
+ zend_declare_typed_property(class_entry, property_errno_name, &property_errno_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_errno_name);
+
+ zval property_error_default_value;
+ ZVAL_UNDEF(&property_error_default_value);
+ zend_string *property_error_name = zend_string_init("error", sizeof("error") - 1, 1);
+ zend_declare_typed_property(class_entry, property_error_name, &property_error_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_error_name);
+
+ zval property_error_list_default_value;
+ ZVAL_UNDEF(&property_error_list_default_value);
+ zend_string *property_error_list_name = zend_string_init("error_list", sizeof("error_list") - 1, 1);
+ zend_declare_typed_property(class_entry, property_error_list_name, &property_error_list_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY));
+ zend_string_release(property_error_list_name);
+
+ zval property_sqlstate_default_value;
+ ZVAL_UNDEF(&property_sqlstate_default_value);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_typed_property(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_sqlstate_name);
+
+ zval property_id_default_value;
+ ZVAL_UNDEF(&property_id_default_value);
+ zend_string *property_id_name = zend_string_init("id", sizeof("id") - 1, 1);
+ zend_declare_typed_property(class_entry, property_id_name, &property_id_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_id_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_warning(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_warning", class_mysqli_warning_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ zval property_message_default_value;
+ ZVAL_UNDEF(&property_message_default_value);
+ zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1);
+ zend_declare_typed_property(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_message_name);
+
+ zval property_sqlstate_default_value;
+ ZVAL_UNDEF(&property_sqlstate_default_value);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_typed_property(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_sqlstate_name);
+
+ zval property_errno_default_value;
+ ZVAL_UNDEF(&property_errno_default_value);
+ zend_string *property_errno_name = zend_string_init("errno", sizeof("errno") - 1, 1);
+ zend_declare_typed_property(class_entry, property_errno_name, &property_errno_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_errno_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_sql_exception(zend_class_entry *class_entry_RuntimeException)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_sql_exception", class_mysqli_sql_exception_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ zval property_sqlstate_default_value;
+ zend_string *property_sqlstate_default_value_str = zend_string_init("00000", sizeof("00000") - 1, 1);
+ ZVAL_STR(&property_sqlstate_default_value, property_sqlstate_default_value_str);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_property_ex(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_sqlstate_name);
+
+ return class_entry;
+}
diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c
index c3fb5e48bb..7f98faf996 100644
--- a/ext/mysqli/mysqli_driver.c
+++ b/ext/mysqli/mysqli_driver.c
@@ -26,101 +26,64 @@
#include "php_mysqli_structs.h"
#include "zend_exceptions.h"
-#define MAP_PROPERTY_MYG_BOOL_READ(name, value) \
-static int name(mysqli_object *obj, zval *retval, zend_bool quiet) \
-{ \
- ZVAL_BOOL(retval, MyG(value)); \
- return SUCCESS; \
-} \
-#define MAP_PROPERTY_MYG_BOOL_WRITE(name, value) \
-static int name(mysqli_object *obj, zval *value) \
-{ \
- MyG(value) = Z_LVAL_P(value) > 0; \
- return SUCCESS; \
-} \
-
-#define MAP_PROPERTY_MYG_LONG_READ(name, value) \
-static int name(mysqli_object *obj, zval *retval, zend_bool quiet) \
-{ \
- ZVAL_LONG(retval, MyG(value)); \
- return SUCCESS; \
-} \
-
-#define MAP_PROPERTY_MYG_LONG_WRITE(name, value) \
-static int name(mysqli_object *obj, zval *value) \
-{ \
- MyG(value) = Z_LVAL_P(value); \
- return SUCCESS; \
-} \
+/* {{{ property driver_report_read */
+static int driver_reconnect_read(mysqli_object *obj, zval *retval, bool quiet)
+{
+ ZVAL_BOOL(retval, MyG(reconnect));
+ return SUCCESS;
+}
+/* }}} */
-#define MAP_PROPERTY_MYG_STRING_READ(name, value) \
-static int name(mysqli_object *obj, zval *retval, zend_bool quiet) \
-{ \
- ZVAL_STRING(retval, MyG(value)); \
- return SUCCESS; \
-} \
+/* {{{ property driver_report_write */
+static int driver_reconnect_write(mysqli_object *obj, zval *value)
+{
+ MyG(reconnect) = Z_LVAL_P(value) > 0;
+ return SUCCESS;
+}
+/* }}} */
-#define MAP_PROPERTY_MYG_STRING_WRITE(name, value) \
-static int name(mysqli_object *obj, zval *value) \
-{ \
- MyG(value) = Z_STRVAL_P(value); \
- return SUCCESS; \
-} \
+/* {{{ property driver_report_read */
+static int driver_report_read(mysqli_object *obj, zval *retval, bool quiet)
+{
+ ZVAL_LONG(retval, MyG(report_mode));
+ return SUCCESS;
+}
+/* }}} */
/* {{{ property driver_report_write */
static int driver_report_write(mysqli_object *obj, zval *value)
{
MyG(report_mode) = Z_LVAL_P(value);
- /*FIXME*/
- /* zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL); */
return SUCCESS;
}
/* }}} */
/* {{{ property driver_client_version_read */
-static int driver_client_version_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int driver_client_version_read(mysqli_object *obj, zval *retval, bool quiet)
{
ZVAL_LONG(retval, mysql_get_client_version());
-
return SUCCESS;
}
/* }}} */
/* {{{ property driver_client_info_read */
-static int driver_client_info_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int driver_client_info_read(mysqli_object *obj, zval *retval, bool quiet)
{
ZVAL_STRING(retval, (char *)mysql_get_client_info());
-
return SUCCESS;
}
/* }}} */
/* {{{ property driver_driver_version_read */
-static int driver_driver_version_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int driver_driver_version_read(mysqli_object *obj, zval *retval, bool quiet)
{
+ zend_error(E_DEPRECATED, "The driver_version property is deprecated");
ZVAL_LONG(retval, MYSQLI_VERSION_ID);
-
return SUCCESS;
}
/* }}} */
-MAP_PROPERTY_MYG_BOOL_READ(driver_reconnect_read, reconnect)
-MAP_PROPERTY_MYG_BOOL_WRITE(driver_reconnect_write, reconnect)
-MAP_PROPERTY_MYG_LONG_READ(driver_report_read, report_mode)
-
-ZEND_FUNCTION(mysqli_driver_construct)
-{
-#ifdef G0
- MYSQLI_RESOURCE *mysqli_resource;
-
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = 1;
- mysqli_resource->status = (ZEND_NUM_ARGS() == 1) ? MYSQLI_STATUS_INITIALIZED : MYSQLI_STATUS_VALID;
- (Z_MYSQLI_P(getThis()))->ptr = mysqli_resource;
-#endif
-}
-
const mysqli_property_entry mysqli_driver_property_entries[] = {
{"client_info", sizeof("client_info") - 1, driver_client_info_read, NULL},
{"client_version", sizeof("client_version") - 1, driver_client_version_read, NULL},
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 364638c44a..907b1e3fbc 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -47,7 +47,7 @@ static void php_mysqli_set_error(zend_long mysql_errno, char *mysql_err)
}
/* }}} */
-void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_connect, zend_bool in_ctor) /* {{{ */
+void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, bool in_ctor) /* {{{ */
{
MY_MYSQL *mysql = NULL;
MYSQLI_RESOURCE *mysqli_resource = NULL;
@@ -56,14 +56,14 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
*ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL,
*ssl_cipher = NULL;
size_t hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
- zend_bool persistent = FALSE, ssl = FALSE;
+ bool persistent = FALSE, ssl = FALSE;
zend_long port = 0, flags = 0;
- zend_bool port_is_null = 1;
+ bool port_is_null = 1;
zend_string *hash_key = NULL;
- zend_bool new_connection = FALSE;
+ bool new_connection = FALSE;
zend_resource *le;
mysqli_plist_entry *plist = NULL;
- zend_bool self_alloced = 0;
+ bool self_alloced = 0;
#if !defined(MYSQL_USE_MYSQLND)
@@ -245,7 +245,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
#ifndef MYSQLI_USE_MYSQLND
if (!(mysql->mysql = mysql_init(NULL))) {
#else
- if (!(mysql->mysql = mysqlnd_init(MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA, persistent))) {
+ if (!(mysql->mysql = mysqlnd_init(MYSQLND_CLIENT_NO_FLAG, persistent))) {
#endif
goto err;
}
@@ -307,7 +307,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
}
}
if (mysqlnd_connect(mysql->mysql, hostname, username, passwd, passwd_len, dbname, dbname_len,
- port, socket, flags, MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA) == NULL)
+ port, socket, flags, MYSQLND_CLIENT_NO_FLAG) == NULL)
#endif
{
/* Save error messages - for mysqli_connect_error() & mysqli_connect_errno() */
@@ -332,6 +332,12 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
unsigned int allow_local_infile = MyG(allow_local_infile);
mysql_options(mysql->mysql, MYSQL_OPT_LOCAL_INFILE, (char *)&allow_local_infile);
+#if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)
+ if (MyG(local_infile_directory) && !php_check_open_basedir(MyG(local_infile_directory))) {
+ mysql_options(mysql->mysql, MYSQL_OPT_LOAD_DATA_LOCAL_DIR, MyG(local_infile_directory));
+ }
+#endif
+
end:
if (!mysqli_resource) {
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
@@ -431,28 +437,39 @@ PHP_FUNCTION(mysqli_fetch_assoc)
/* }}} */
/* {{{ Fetches all result rows as an associative array, a numeric array, or both */
-#ifdef MYSQLI_USE_MYSQLND
PHP_FUNCTION(mysqli_fetch_all)
{
MYSQL_RES *result;
zval *mysql_result;
- zend_long mode = MYSQLND_FETCH_NUM;
+ zend_long mode = MYSQLI_NUM;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) {
RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
- if (!mode || (mode & ~MYSQLND_FETCH_BOTH)) {
+ if (!mode || (mode & ~MYSQLI_BOTH)) {
zend_argument_value_error(ERROR_ARG_POS(2), "must be one of MYSQLI_FETCH_NUM, "
"MYSQLI_FETCH_ASSOC, or MYSQLI_FETCH_BOTH");
RETURN_THROWS();
}
- mysqlnd_fetch_all(result, mode, return_value);
+ array_init_size(return_value, mysql_num_rows(result));
+
+ zend_ulong i = 0;
+ do {
+ zval row;
+ php_mysqli_fetch_into_hash_aux(&row, result, mode);
+ if (Z_TYPE(row) != IS_ARRAY) {
+ zval_ptr_dtor_nogc(&row);
+ break;
+ }
+ add_index_zval(return_value, i++, &row);
+ } while (1);
}
/* }}} */
+#ifdef MYSQLI_USE_MYSQLND
/* {{{ Returns statistics about the zval cache */
PHP_FUNCTION(mysqli_get_client_stats)
{
@@ -689,12 +706,7 @@ PHP_FUNCTION(mysqli_query)
switch (resultmode & ~MYSQLI_ASYNC) {
#endif
case MYSQLI_STORE_RESULT:
-#ifdef MYSQLI_USE_MYSQLND
- if (resultmode & MYSQLI_STORE_RESULT_COPY_DATA) {
- result = mysqlnd_store_result_ofs(mysql->mysql);
- } else
-#endif
- result = mysql_store_result(mysql->mysql);
+ result = mysql_store_result(mysql->mysql);
break;
case MYSQLI_USE_RESULT:
result = mysql_use_result(mysql->mysql);
@@ -1197,7 +1209,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
#ifndef MYSQLI_USE_MYSQLND
/* {{{ */
-static int mysqli_savepoint_libmysql(MYSQL * conn, const char * const name, zend_bool release)
+static int mysqli_savepoint_libmysql(MYSQL * conn, const char * const name, bool release)
{
int ret;
char * query;
diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h
index f537514968..0e8baba576 100644
--- a/ext/mysqli/mysqli_priv.h
+++ b/ext/mysqli/mysqli_priv.h
@@ -127,8 +127,8 @@ if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql_stmt_errno(stmt)) { \
php_mysqli_report_error(mysql_stmt_sqlstate(stmt), mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); \
}
-void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_connect, zend_bool in_ctor);
+void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, bool in_ctor);
-void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_method);
+void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, bool is_method);
#endif /* MYSQLI_PRIV_H */
diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index 2ee059c756..a44af2a5ed 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.c
@@ -71,44 +71,62 @@ if (!obj->ptr) { \
p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->stmt; \
}
-#define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\
-static int __func(mysqli_object *obj, zval *retval, zend_bool quiet) \
+#define MYSQLI_MAP_PROPERTY_FUNC_LONG_OR_STR( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\
+static int __func(mysqli_object *obj, zval *retval, bool quiet) \
{\
__ret_type l;\
__get_type;\
- if (!p) {\
- ZVAL_NULL(retval);\
- } else {\
- l = (__ret_type)__int_func(p);\
- if (l < ZEND_LONG_MAX) {\
- ZVAL_LONG(retval, (zend_long) l);\
- } else { \
- ZVAL_NEW_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
- } \
+ ZEND_ASSERT(p);\
+ l = (__ret_type)__int_func(p);\
+ if (l < ZEND_LONG_MAX) {\
+ ZVAL_LONG(retval, (zend_long) l);\
+ } else { \
+ ZVAL_NEW_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
} \
return SUCCESS; \
}
-#define MYSQLI_MAP_PROPERTY_FUNC_STRING(__func, __int_func, __get_type)\
-static int __func(mysqli_object *obj, zval *retval, zend_bool quiet)\
+#define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\
+static int __func(mysqli_object *obj, zval *retval, bool quiet) \
+{\
+ __ret_type l;\
+ __get_type;\
+ ZEND_ASSERT(p);\
+ l = (__ret_type)__int_func(p);\
+ ZEND_ASSERT(l < ZEND_LONG_MAX);\
+ ZVAL_LONG(retval, (zend_long) l);\
+ return SUCCESS; \
+}
+
+#define MYSQLI_MAP_PROPERTY_FUNC_STR_OR_NULL(__func, __int_func, __get_type)\
+static int __func(mysqli_object *obj, zval *retval, bool quiet)\
{\
char *c;\
__get_type;\
- if (!p) {\
- ZVAL_NULL(retval);\
+ ZEND_ASSERT(p);\
+ c = (char *)__int_func(p);\
+ if (c) {\
+ ZVAL_STRING(retval, c);\
} else {\
- c = (char *)__int_func(p);\
- if (!c) {\
- ZVAL_NULL(retval);\
- } else {\
- ZVAL_STRING(retval, c);\
- }\
+ ZVAL_NULL(retval);\
}\
return SUCCESS; \
}
+#define MYSQLI_MAP_PROPERTY_FUNC_STR(__func, __int_func, __get_type)\
+static int __func(mysqli_object *obj, zval *retval, bool quiet)\
+{\
+ char *c;\
+ __get_type;\
+ ZEND_ASSERT(p);\
+ c = (char *)__int_func(p);\
+ ZEND_ASSERT(c);\
+ ZVAL_STRING(retval, c);\
+ return SUCCESS; \
+}
+
/* {{{ property link_client_version_read */
-static int link_client_version_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int link_client_version_read(mysqli_object *obj, zval *retval, bool quiet)
{
ZVAL_LONG(retval, MYSQL_VERSION_ID);
@@ -117,9 +135,8 @@ static int link_client_version_read(mysqli_object *obj, zval *retval, zend_bool
/* }}} */
/* {{{ property link_client_info_read */
-static int link_client_info_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int link_client_info_read(mysqli_object *obj, zval *retval, bool quiet)
{
- CHECK_STATUS(MYSQLI_STATUS_INITIALIZED, quiet);
ZVAL_STRING(retval, MYSQL_SERVER_VERSION);
return SUCCESS;
@@ -127,7 +144,7 @@ static int link_client_info_read(mysqli_object *obj, zval *retval, zend_bool qui
/* }}} */
/* {{{ property link_connect_errno_read */
-static int link_connect_errno_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int link_connect_errno_read(mysqli_object *obj, zval *retval, bool quiet)
{
ZVAL_LONG(retval, (zend_long)MyG(error_no));
@@ -136,7 +153,7 @@ static int link_connect_errno_read(mysqli_object *obj, zval *retval, zend_bool q
/* }}} */
/* {{{ property link_connect_error_read */
-static int link_connect_error_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int link_connect_error_read(mysqli_object *obj, zval *retval, bool quiet)
{
if (MyG(error_msg)) {
ZVAL_STRING(retval, MyG(error_msg));
@@ -149,32 +166,27 @@ static int link_connect_error_read(mysqli_object *obj, zval *retval, zend_bool q
/* }}} */
/* {{{ property link_affected_rows_read */
-static int link_affected_rows_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int link_affected_rows_read(mysqli_object *obj, zval *retval, bool quiet)
{
MY_MYSQL *mysql;
my_ulonglong rc;
- CHECK_STATUS(MYSQLI_STATUS_INITIALIZED, quiet);
+ CHECK_STATUS(MYSQLI_STATUS_VALID, quiet);
mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
+ ZEND_ASSERT(mysql);
- if (!mysql) {
- ZVAL_NULL(retval);
- } else {
- CHECK_STATUS(MYSQLI_STATUS_VALID, quiet);
+ rc = mysql_affected_rows(mysql->mysql);
- rc = mysql_affected_rows(mysql->mysql);
-
- if (rc == (my_ulonglong) -1) {
- ZVAL_LONG(retval, -1);
- return SUCCESS;
- }
+ if (rc == (my_ulonglong) -1) {
+ ZVAL_LONG(retval, -1);
+ return SUCCESS;
+ }
- if (rc < ZEND_LONG_MAX) {
- ZVAL_LONG(retval, (zend_long) rc);
- } else {
- ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
- }
+ if (rc < ZEND_LONG_MAX) {
+ ZVAL_LONG(retval, (zend_long) rc);
+ } else {
+ ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
}
return SUCCESS;
@@ -182,7 +194,7 @@ static int link_affected_rows_read(mysqli_object *obj, zval *retval, zend_bool q
/* }}} */
/* {{{ property link_error_list_read */
-static int link_error_list_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int link_error_list_read(mysqli_object *obj, zval *retval, bool quiet)
{
MY_MYSQL *mysql;
@@ -228,46 +240,43 @@ static int link_error_list_read(mysqli_object *obj, zval *retval, zend_bool quie
/* link properties */
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED))
+MYSQLI_MAP_PROPERTY_FUNC_STR(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED))
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
-MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
-MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_STR(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
+MYSQLI_MAP_PROPERTY_FUNC_STR_OR_NULL(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
+MYSQLI_MAP_PROPERTY_FUNC_LONG_OR_STR(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
+MYSQLI_MAP_PROPERTY_FUNC_STR(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
+MYSQLI_MAP_PROPERTY_FUNC_STR(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
/* result properties */
/* {{{ property result_type_read */
-static int result_type_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int result_type_read(mysqli_object *obj, zval *retval, bool quiet)
{
MYSQL_RES *p;
CHECK_STATUS(MYSQLI_STATUS_VALID, quiet);
p = (MYSQL_RES *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
- if (!p) {
- ZVAL_NULL(retval);
- } else {
- ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT);
- }
+ ZEND_ASSERT(p);
+ ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT);
return SUCCESS;
}
/* }}} */
/* {{{ property result_lengths_read */
-static int result_lengths_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int result_lengths_read(mysqli_object *obj, zval *retval, bool quiet)
{
MYSQL_RES *p;
#ifdef MYSQLI_USE_MYSQLND
const size_t *ret;
#else
- const zend_ulong *ret;
+ const unsigned long *ret;
#endif
uint32_t field_count;
@@ -292,12 +301,12 @@ static int result_lengths_read(mysqli_object *obj, zval *retval, zend_bool quiet
MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG_OR_STR(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
/* statement properties */
/* {{{ property stmt_id_read */
-static int stmt_id_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int stmt_id_read(mysqli_object *obj, zval *retval, bool quiet)
{
MY_STMT *p;
@@ -305,18 +314,15 @@ static int stmt_id_read(mysqli_object *obj, zval *retval, zend_bool quiet)
p = (MY_STMT*)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
- if (!p) {
- ZVAL_NULL(retval);
- } else {
- ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt));
- }
+ ZEND_ASSERT(p);
+ ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt));
return SUCCESS;
}
/* }}} */
/* {{{ property stmt_affected_rows_read */
-static int stmt_affected_rows_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int stmt_affected_rows_read(mysqli_object *obj, zval *retval, bool quiet)
{
MY_STMT *p;
my_ulonglong rc;
@@ -325,21 +331,18 @@ static int stmt_affected_rows_read(mysqli_object *obj, zval *retval, zend_bool q
p = (MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
- if (!p) {
- ZVAL_NULL(retval);
- } else {
- rc = mysql_stmt_affected_rows(p->stmt);
+ ZEND_ASSERT(p);
+ rc = mysql_stmt_affected_rows(p->stmt);
- if (rc == (my_ulonglong) -1) {
- ZVAL_LONG(retval, -1);
- return SUCCESS;
- }
+ if (rc == (my_ulonglong) -1) {
+ ZVAL_LONG(retval, -1);
+ return SUCCESS;
+ }
- if (rc < ZEND_LONG_MAX) {
- ZVAL_LONG(retval, (zend_long) rc);
- } else {
- ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
- }
+ if (rc < ZEND_LONG_MAX) {
+ ZVAL_LONG(retval, (zend_long) rc);
+ } else {
+ ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
}
return SUCCESS;
@@ -347,7 +350,7 @@ static int stmt_affected_rows_read(mysqli_object *obj, zval *retval, zend_bool q
/* }}} */
/* {{{ property stmt_error_list_read */
-static int stmt_error_list_read(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int stmt_error_list_read(mysqli_object *obj, zval *retval, bool quiet)
{
MY_STMT * stmt;
@@ -390,13 +393,13 @@ static int stmt_error_list_read(mysqli_object *obj, zval *retval, zend_bool quie
}
/* }}} */
-MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
-MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG_OR_STR(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG_OR_STR(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
-MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
+MYSQLI_MAP_PROPERTY_FUNC_STR(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
+MYSQLI_MAP_PROPERTY_FUNC_STR(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
/* }}} */
const mysqli_property_entry mysqli_link_property_entries[] = {
diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index 7b1552e5ac..9d2b05b30a 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.c
@@ -125,13 +125,13 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql)
return NULL;
}
- result = mysql->m->use_result(mysql, 0);
+ result = mysql->m->use_result(mysql);
for (;;) {
zval *entry;
int errno;
- mysqlnd_fetch_into(result, MYSQLND_FETCH_NUM, &row, MYSQLND_MYSQLI);
+ mysqlnd_fetch_into(result, MYSQLND_FETCH_NUM, &row);
if (Z_TYPE(row) != IS_ARRAY) {
zval_ptr_dtor(&row);
break;
@@ -195,7 +195,7 @@ PHP_METHOD(mysqli_warning, next)
/* }}} */
/* {{{ property mysqli_warning_message */
-static int mysqli_warning_message(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int mysqli_warning_message(mysqli_object *obj, zval *retval, bool quiet)
{
MYSQLI_WARNING *w;
@@ -215,7 +215,7 @@ static int mysqli_warning_message(mysqli_object *obj, zval *retval, zend_bool qu
/* }}} */
/* {{{ property mysqli_warning_sqlstate */
-static int mysqli_warning_sqlstate(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int mysqli_warning_sqlstate(mysqli_object *obj, zval *retval, bool quiet)
{
MYSQLI_WARNING *w;
@@ -235,7 +235,7 @@ static int mysqli_warning_sqlstate(mysqli_object *obj, zval *retval, zend_bool q
/* }}} */
/* {{{ property mysqli_warning_error */
-static int mysqli_warning_errno(mysqli_object *obj, zval *retval, zend_bool quiet)
+static int mysqli_warning_errno(mysqli_object *obj, zval *retval, bool quiet)
{
MYSQLI_WARNING *w;
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index 16ed9ddefc..5a80e2f6bf 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -46,6 +46,7 @@ typedef _Bool my_bool;
#include <errmsg.h>
#include <mysqld_error.h>
#include "mysqli_libmysql.h"
+
#endif /* MYSQLI_USE_MYSQLND */
@@ -88,7 +89,7 @@ typedef struct {
zval li_read;
php_stream *li_stream;
unsigned int multi_query;
- zend_bool persistent;
+ bool persistent;
#ifdef MYSQLI_USE_MYSQLND
int async_result_fetch_type;
#endif
@@ -124,7 +125,7 @@ struct st_mysqli_warning {
typedef struct _mysqli_property_entry {
const char *pname;
size_t pname_length;
- int (*r_func)(mysqli_object *obj, zval *retval, zend_bool quiet);
+ int (*r_func)(mysqli_object *obj, zval *retval, bool quiet);
int (*w_func)(mysqli_object *obj, zval *value);
} mysqli_property_entry;
@@ -186,13 +187,6 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
mysql->multi_query = 1; \
}
-#define REGISTER_MYSQLI_CLASS_ENTRY(name, mysqli_entry, class_functions) { \
- zend_class_entry ce; \
- INIT_CLASS_ENTRY(ce, name,class_functions); \
- ce.create_object = mysqli_objects_new; \
- mysqli_entry = zend_register_internal_class(&ce); \
-} \
-
#define MYSQLI_REGISTER_RESOURCE_EX(__ptr, __zval) \
(Z_MYSQLI_P(__zval))->ptr = __ptr;
@@ -269,27 +263,24 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
ZEND_BEGIN_MODULE_GLOBALS(mysqli)
- zend_long default_link;
zend_long num_links;
zend_long max_links;
zend_long num_active_persistent;
zend_long num_inactive_persistent;
zend_long max_persistent;
zend_long allow_persistent;
- zend_ulong default_port;
- char *default_host;
- char *default_user;
- char *default_socket;
- char *default_pw;
+ zend_ulong default_port;
+ char *default_host;
+ char *default_user;
+ char *default_pw;
+ char *default_socket;
zend_long reconnect;
zend_long allow_local_infile;
- zend_long strict;
+ char *local_infile_directory;
zend_long error_no;
- char *error_msg;
+ char *error_msg;
zend_long report_mode;
- HashTable *report_ht;
- zend_ulong multi_query;
- zend_bool rollback_on_cached_plink;
+ bool rollback_on_cached_plink;
ZEND_END_MODULE_GLOBALS(mysqli)
#define MyG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mysqli, v)
diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt
index 56a26602df..62f397587e 100644
--- a/ext/mysqli/tests/003.phpt
+++ b/ext/mysqli/tests/003.phpt
@@ -92,7 +92,7 @@ array(7) {
[2]=>
string(19) "2002-01-02 17:46:59"
[3]=>
- int(2010)
+ string(4) "2010"
[4]=>
string(19) "2010-07-10 00:00:00"
[5]=>
diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt
index a2a8782f0f..d3bbd59332 100644
--- a/ext/mysqli/tests/020.phpt
+++ b/ext/mysqli/tests/020.phpt
@@ -87,7 +87,7 @@ array(7) {
[2]=>
%s(19) "2002-01-02 17:46:59"
[3]=>
- int(2010)
+ string(4) "2010"
[4]=>
%s(19) "2010-07-10 00:00:00"
[5]=>
diff --git a/ext/mysqli/tests/073.phpt b/ext/mysqli/tests/073.phpt
deleted file mode 100644
index c03cb2236d..0000000000
--- a/ext/mysqli/tests/073.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-mysqli_driver properties
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
- require_once("connect.inc");
-
- var_dump($driver->client_version);
- var_dump($driver->client_info);
- var_dump($driver->driver_version);
- var_dump($driver->reconnect);
- var_dump($driver->report_mode);
- print "done!";
-?>
---EXPECTF--
-int(%d)
-string(%d) "%s"
-int(%d)
-bool(%s)
-int(%d)
-done!
diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt
index 9157a13b9a..e1568d3038 100644
--- a/ext/mysqli/tests/bug34810.phpt
+++ b/ext/mysqli/tests/bug34810.phpt
@@ -12,13 +12,14 @@ class DbConnection {
public function connect() {
require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /* Pass false as $connect_flags cannot be accessed via globals. */
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, false);
var_dump($link);
$link = mysqli_init();
var_dump($link);
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket, false);
$mysql->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/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt
index 4d02475570..c0815c7f04 100644
--- a/ext/mysqli/tests/bug62885.phpt
+++ b/ext/mysqli/tests/bug62885.phpt
@@ -12,11 +12,11 @@ if (!$IS_MYSQLND) {
<?php
error_reporting(E_ALL);
$tablica = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
+$test1 = mysqli_poll($test2, $test3, $tablica, 0);
$test2 = array();
$test2 = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
+$test1 = mysqli_poll($test2, $test3, $tablica, 0);
echo "okey";
?>
--EXPECTF--
diff --git a/ext/mysqli/tests/bug66124.phpt b/ext/mysqli/tests/bug66124.phpt
index cede635e14..8a2e5a5f73 100644
--- a/ext/mysqli/tests/bug66124.phpt
+++ b/ext/mysqli/tests/bug66124.phpt
@@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
-$table_drop = "DROP TABLE IF EXISTS `bug66124`";
-$table_create = "CREATE TABLE `bug66124` (
+$table_drop = "DROP TABLE IF EXISTS `test`";
+$table_create = "CREATE TABLE `test` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
-$table_insert = "INSERT INTO `bug66124` SET `id`=?";
-$table_select = "SELECT * FROM `bug66124`";
-$table_delete = "DELETE FROM `bug66124`";
+$table_insert = "INSERT INTO `test` SET `id`=?";
+$table_select = "SELECT * FROM `test`";
+$table_delete = "DELETE FROM `test`";
$id = '1311200011005001566';
@@ -91,6 +91,10 @@ if ($result){
$link->close();
?>
done
+--CLEAN--
+<?php
+require_once "clean_table.inc";
+?>
--EXPECT--
Using 'i':
insert id:1311200011005001566=>1311200011005001566
diff --git a/ext/mysqli/tests/bug75018.phpt b/ext/mysqli/tests/bug75018.phpt
index 28af0bb77c..ce522aab87 100644
--- a/ext/mysqli/tests/bug75018.phpt
+++ b/ext/mysqli/tests/bug75018.phpt
@@ -11,7 +11,7 @@ require_once("connect.inc");
$mysqli = new mysqli("$host:$port", $user, $passwd, $db);
-$tbl = "test_bug75018";
+$tbl = "test";
$sql = "DROP TABLE IF EXISTS $tbl";
$mysqli->query($sql);
@@ -31,6 +31,10 @@ while ($row = $result->fetch_assoc()) {
}
?>
+--CLEAN--
+<?php
+require_once "clean_table.inc";
+?>
--EXPECT--
string(1) "0"
string(4) "1365"
diff --git a/ext/mysqli/tests/bug75434.phpt b/ext/mysqli/tests/bug75434.phpt
index 1bc325e29f..3e295d83bf 100644
--- a/ext/mysqli/tests/bug75434.phpt
+++ b/ext/mysqli/tests/bug75434.phpt
@@ -3,7 +3,6 @@ Bug #75434 Wrong reflection for mysqli_fetch_all function
--SKIPIF--
<?php
require_once('skipif.inc');
-if (!stristr(mysqli_get_client_info(), 'mysqlnd')) die("skip: only available in mysqlnd");
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/bug77597.phpt b/ext/mysqli/tests/bug77597.phpt
index 52ae874454..cd9055deb7 100644
--- a/ext/mysqli/tests/bug77597.phpt
+++ b/ext/mysqli/tests/bug77597.phpt
@@ -12,11 +12,11 @@ if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
require_once("connect.inc");
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
-$mysqli->query('DROP TABLE IF EXISTS a');
-$mysqli->query('CREATE TABLE a (b int)');
-$mysqli->query('INSERT INTO a VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
+$mysqli->query('DROP TABLE IF EXISTS test');
+$mysqli->query('CREATE TABLE test (b int)');
+$mysqli->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
-$mysqli->real_query("SELECT * FROM a");
+$mysqli->real_query("SELECT * FROM test");
$result = $mysqli->store_result(MYSQLI_STORE_RESULT_COPY_DATA);
@@ -24,5 +24,9 @@ $field = $result->fetch_field();
var_dump($field->name);
?>
+--CLEAN--
+<?php
+require_once "clean_table.inc";
+?>
--EXPECT--
string(1) "b"
diff --git a/ext/mysqli/tests/bug77935.phpt b/ext/mysqli/tests/bug77935.phpt
index 7a39ac0065..9917488a25 100644
--- a/ext/mysqli/tests/bug77935.phpt
+++ b/ext/mysqli/tests/bug77935.phpt
@@ -31,6 +31,13 @@ while ($row = $result->fetch_assoc()) {
}
?>
+--CLEAN--
+<?php
+require_once 'connect.inc';
+$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
+$link->query('DROP PROCEDURE IF EXISTS testSp');
+$link->close();
+?>
--EXPECT--
array(1) {
[1]=>
diff --git a/ext/mysqli/tests/bug77956.phpt b/ext/mysqli/tests/bug77956.phpt
index c76e1021e1..19df063951 100644
--- a/ext/mysqli/tests/bug77956.phpt
+++ b/ext/mysqli/tests/bug77956.phpt
@@ -55,6 +55,5 @@ $link->close();
unlink('bug77956.data');
?>
--EXPECTF--
-Warning: mysqli::query(): LOAD DATA LOCAL INFILE forbidden in %s on line %d
-[006] [2000] LOAD DATA LOCAL INFILE is forbidden, check mysqli.allow_local_infile
-done
+[006] [2000] LOAD DATA LOCAL INFILE is forbidden, check related settings like mysqli.allow_local_infile|mysqli.local_infile_directory or PDO::MYSQL_ATTR_LOCAL_INFILE|PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY
+done \ No newline at end of file
diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc
index 604ecc97ea..e8f56cf249 100644
--- a/ext/mysqli/tests/connect.inc
+++ b/ext/mysqli/tests/connect.inc
@@ -7,6 +7,7 @@
*/
$driver = new mysqli_driver;
+ $driver->report_mode = MYSQLI_REPORT_OFF;
$host = getenv("MYSQL_TEST_HOST") ?: "127.0.0.1";
$port = getenv("MYSQL_TEST_PORT") ?: 3306;
@@ -51,7 +52,7 @@
if (!function_exists('my_mysqli_connect')) {
/**
- * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+ * Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
*
* @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
*/
@@ -71,7 +72,7 @@
}
/**
- * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+ * Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
*
* @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
*/
diff --git a/ext/mysqli/tests/foo/bar/bar.data b/ext/mysqli/tests/foo/bar/bar.data
new file mode 100644
index 0000000000..56e5e8cdce
--- /dev/null
+++ b/ext/mysqli/tests/foo/bar/bar.data
@@ -0,0 +1,3 @@
+97
+98
+99
diff --git a/ext/mysqli/tests/foo/foo.data b/ext/mysqli/tests/foo/foo.data
new file mode 100644
index 0000000000..01e79c32a8
--- /dev/null
+++ b/ext/mysqli/tests/foo/foo.data
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/ext/mysqli/tests/local_infile_tools.inc b/ext/mysqli/tests/local_infile_tools.inc
index fef400d0a9..d45d15e6ac 100644
--- a/ext/mysqli/tests/local_infile_tools.inc
+++ b/ext/mysqli/tests/local_infile_tools.inc
@@ -6,8 +6,7 @@
}
}
- function check_local_infile_support($link, $engine, $table_name = 'test') {
-
+ function check_local_infile_allowed_by_server($link) {
if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"'))
return "Cannot check if Server variable 'local_infile' is set to 'ON'";
@@ -16,6 +15,15 @@
if ('ON' != $row['Value'])
return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']);
+ return "";
+ }
+
+ function check_local_infile_support($link, $engine, $table_name = 'test') {
+ $res = check_local_infile_allowed_by_server($link);
+ if ($res) {
+ return $res;
+ }
+
if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) {
return "Failed to drop old test table";
}
diff --git a/ext/mysqli/tests/mysqli_allow_local_infile_overrides_local_infile_directory.phpt b/ext/mysqli/tests/mysqli_allow_local_infile_overrides_local_infile_directory.phpt
new file mode 100644
index 0000000000..187701ff8c
--- /dev/null
+++ b/ext/mysqli/tests/mysqli_allow_local_infile_overrides_local_infile_directory.phpt
@@ -0,0 +1,75 @@
+--TEST--
+mysqli.allow_local_infile overrides mysqli.local_infile_directory
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_allowed_by_server($link))
+ die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
+?>
+--INI--
+open_basedir={PWD}
+mysqli.allow_local_infile=1
+mysqli.local_infile_directory={PWD}/foo/bar
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE test (id INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $filepath = str_replace('\\', '/', __DIR__.'/foo/foo.data');
+ if (!$link->query("LOAD DATA LOCAL INFILE '".$filepath."' INTO TABLE test")) {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ $row_count = $row['num'];
+ $expected_row_count = 3;
+ if ($row_count != $expected_row_count) {
+ printf("[005] %d != %d\n", $row_count, $expected_row_count);
+ }
+ } else {
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $link->close();
+ echo "done";
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+$link->close();
+?>
+--EXPECT--
+done
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
index 55fd3be47e..ebf9c7f2b7 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
@@ -3,81 +3,80 @@ Interface of the class mysqli_driver
--SKIPIF--
<?php
require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
- $driver = new mysqli_driver();
+$driver = new mysqli_driver();
- printf("Parent class:\n");
- var_dump(get_parent_class($driver));
+printf("Parent class:\n");
+var_dump(get_parent_class($driver));
- printf("\nMethods:\n");
- $methods = get_class_methods($driver);
- $expected_methods = array();
+printf("\nMethods:\n");
+$methods = get_class_methods($driver);
+$expected_methods = [];
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($expected_methods[$method]);
- unset($methods[$k]);
- }
+foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($expected_methods[$method], $methods[$k]);
}
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (empty($expected_methods) && empty($methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($driver)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($driver));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert(mysqli_get_client_info() === $driver->client_info);
- printf("driver->client_info = '%s'\n", $driver->client_info);
-
- assert(mysqli_get_client_version() === $driver->client_version);
- printf("driver->client_version = '%s'\n", $driver->client_version);
-
- assert($driver->driver_version > 0);
- printf("driver->driver_version = '%s'\n", $driver->driver_version);
-
- assert(in_array($driver->report_mode,
- array(
- MYSQLI_REPORT_ALL,
- MYSQLI_REPORT_STRICT,
- MYSQLI_REPORT_ERROR,
- MYSQLI_REPORT_INDEX,
- MYSQLI_REPORT_OFF
- )
- ));
-
- printf("driver->report_mode = '%s'\n", $driver->report_mode);
- $driver->report_mode = MYSQLI_REPORT_STRICT;
- assert($driver->report_mode === MYSQLI_REPORT_STRICT);
-
- printf("driver->reconnect = '%s'\n", $driver->reconnect);
-
- printf("\nAccess to undefined properties:\n");
- printf("driver->unknown = '%s'\n", @$driver->unknown);
-
- print "done!";
+}
+if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+}
+if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+}
+if (empty($expected_methods) && empty($methods)) {
+ printf("ok\n");
+}
+
+printf("\nClass variables:\n");
+$variables = array_keys(get_class_vars(get_class($driver)));
+sort($variables);
+foreach ($variables as $var) {
+ printf("%s\n", $var);
+}
+
+printf("\nObject variables:\n");
+$variables = array_keys(get_object_vars($driver));
+foreach ($variables as $var) {
+ printf("%s\n", $var);
+}
+
+printf("\nMagic, magic properties:\n");
+
+assert(mysqli_get_client_info() === $driver->client_info);
+printf("driver->client_info = '%s'\n", $driver->client_info);
+
+assert(mysqli_get_client_version() === $driver->client_version);
+printf("driver->client_version = '%s'\n", $driver->client_version);
+
+printf("driver->driver_version = '%s'\n", $driver->driver_version);
+
+assert(in_array($driver->report_mode, [
+ MYSQLI_REPORT_ALL,
+ MYSQLI_REPORT_STRICT,
+ MYSQLI_REPORT_STRICT|MYSQLI_REPORT_ERROR,
+ MYSQLI_REPORT_STRICT|MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_ERROR,
+ MYSQLI_REPORT_ERROR|MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_OFF
+]));
+
+printf("driver->report_mode = '%s'\n", $driver->report_mode);
+$driver->report_mode = MYSQLI_REPORT_STRICT;
+assert($driver->report_mode === MYSQLI_REPORT_STRICT);
+
+printf("driver->reconnect = '%s'\n", $driver->reconnect);
+
+printf("\nAccess to undefined properties:\n");
+printf("driver->unknown = '%s'\n", @$driver->unknown);
+
+print "done!";
?>
--EXPECTF--
Parent class:
@@ -94,15 +93,14 @@ reconnect
report_mode
Object variables:
-client_info
-client_version
-driver_version
reconnect
report_mode
Magic, magic properties:
driver->client_info = '%s'
driver->client_version = '%d'
+
+Deprecated: The driver_version property is deprecated in %s on line %d
driver->driver_version = '%d'
driver->report_mode = '%d'
driver->reconnect = ''
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
index 48706fcf6e..d0d858b9de 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
@@ -92,7 +92,7 @@ require_once('skipifconnectfailure.inc');
printf("\nClass variables:\n");
- $expected_class_variables = $expected_object_variables = array(
+ $expected_class_variables = [
"affected_rows" => true,
"client_info" => true,
"client_version" => true,
@@ -110,10 +110,10 @@ require_once('skipifconnectfailure.inc');
"sqlstate" => true,
"thread_id" => true,
"warning_count" => true,
- );
+ "error_list" => true,
+ ];
- $expected_class_variables["error_list"] = true;
- $expected_object_variables["error_list"] = true;
+ $expected_object_variables = [];
$variables = get_class_vars(get_class($mysqli));
foreach ($variables as $var => $v) {
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
index 651520b70a..b04fb93e9c 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
@@ -45,11 +45,7 @@ require_once('skipifconnectfailure.inc');
echo $exception->getMessage() . "\n";
}
- try {
- $mysqli->client_info;
- } catch (Error $exception) {
- echo $exception->getMessage() . "\n";
- }
+ printf("mysqli->client_info = '%s'/%s\n", $mysqli->client_info, gettype($mysqli->client_info));
printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version));
@@ -242,7 +238,7 @@ Without RS
Class variables:
Property access is not allowed yet
-Property access is not allowed yet
+client_info = '%s'
client_version = '%s'
connect_errno = '%s'
connect_error = ''%s'
@@ -261,29 +257,11 @@ mysqli object is already closed
mysqli object is already closed
Object variables:
-Property access is not allowed yet
-Property access is not allowed yet
-client_version = '%s'
-connect_errno = '%s'
-connect_error = ''%s'
-mysqli object is already closed
-mysqli object is already closed
-Property access is not allowed yet
-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
-mysqli object is already closed
-mysqli object is already closed
-mysqli object is already closed
-mysqli object is already closed
Magic, magic properties:
mysqli object is already closed
Property access is not allowed yet
-Property access is not allowed yet
+mysqli->client_info = '%s'/string
mysqli->client_version = '%d'/integer
mysqli object is already closed
mysqli object is already closed
@@ -324,7 +302,7 @@ mysqli object is already closed
Class variables:
Property access is not allowed yet
-Property access is not allowed yet
+client_info = '%s'
client_version = '%s'
connect_errno = '%s'
connect_error = '%s'
@@ -343,29 +321,11 @@ mysqli object is already closed
mysqli object is already closed
Object variables:
-Property access is not allowed yet
-Property access is not allowed yet
-client_version = '%s'
-connect_errno = '%s'
-connect_error = '%s'
-mysqli object is already closed
-mysqli object is already closed
-Property access is not allowed yet
-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
-mysqli object is already closed
-mysqli object is already closed
-mysqli object is already closed
-mysqli object is already closed
Magic, magic properties:
mysqli object is already closed
Property access is not allowed yet
-Property access is not allowed yet
+mysqli->client_info = '%s'/string
mysqli->client_version = '%d'/integer
mysqli object is already closed
mysqli object is already closed
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
index 629697a50c..27656417e5 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
@@ -27,6 +27,7 @@ require_once('skipifconnectfailure.inc');
'__construct' => true,
'close' => true,
'data_seek' => true,
+ 'fetch_all' => true,
'fetch_array' => true,
'fetch_assoc' => true,
'fetch_field' => true,
@@ -39,8 +40,6 @@ require_once('skipifconnectfailure.inc');
'free_result' => true,
'getIterator' => true,
);
- if ($IS_MYSQLND)
- $expected_methods['fetch_all'] = true;
foreach ($methods as $k => $method) {
if (isset($expected_methods[$method])) {
@@ -163,11 +162,6 @@ num_rows
type
Object variables:
-current_field
-field_count
-lengths
-num_rows
-type
Magic, magic properties:
mysqli_result->current_field = '0'/integer ('0'/integer)
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
index 393e06ebaa..b10877a285 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
@@ -153,16 +153,6 @@ param_count
sqlstate
Object variables:
-affected_rows
-insert_id
-num_rows
-param_count
-field_count
-errno
-error
-error_list
-sqlstate
-id
Magic, magic properties:
mysqli_stmt object is not fully initialized
diff --git a/ext/mysqli/tests/mysqli_constants.phpt b/ext/mysqli/tests/mysqli_constants.phpt
index 22e3cd9d2b..8538fafa4f 100644
--- a/ext/mysqli/tests/mysqli_constants.phpt
+++ b/ext/mysqli/tests/mysqli_constants.phpt
@@ -93,6 +93,7 @@ mysqli.allow_local_infile=1
"MYSQLI_REFRESH_HOSTS" => true,
"MYSQLI_REFRESH_STATUS" => true,
"MYSQLI_REFRESH_THREADS" => true,
+ "MYSQLI_REFRESH_REPLICA" => true,
"MYSQLI_REFRESH_SLAVE" => true,
"MYSQLI_REFRESH_MASTER" => true,
"MYSQLI_DEBUG_TRACE_ENABLED" => true,
@@ -201,6 +202,10 @@ mysqli.allow_local_infile=1
$expected_constants["MYSQLI_TYPE_JSON"] = true;
}
+ if ($version > 80210 || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_OPT_LOAD_DATA_LOCAL_DIR'] = true;
+ }
+
$unexpected_constants = array();
foreach ($constants as $group => $consts) {
diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt
index 4ef41e355c..a756766df6 100644
--- a/ext/mysqli/tests/mysqli_driver.phpt
+++ b/ext/mysqli/tests/mysqli_driver.phpt
@@ -7,102 +7,118 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require("table.inc");
+require_once('connect.inc');
- if (!is_object($driver = new mysqli_driver()))
- printf("[001] Failed to create mysqli_driver object\n");
+if (!is_object($driver = new mysqli_driver())) {
+ printf("[001] Failed to create mysqli_driver object\n");
+}
- $client_info = mysqli_get_client_info();
- if (($tmp = $driver->client_info) !== $client_info)
- printf("[002] Expecting %s/%s, got %s/%s\n",
- gettype($client_info), $client_info,
- gettype($tmp), $tmp);
-
- $client_version = mysqli_get_client_version();
- if (($tmp = $driver->client_version) !== $client_version)
- printf("[003] Expecting %s/%s, got %s/%s\n",
- gettype($client_version), $client_version,
- gettype($tmp), $tmp);
-
- if (!is_int($tmp = $driver->driver_version) || (0 == $tmp))
- printf("[004] Expecting int/any, got %s/%s\n",
+$client_info = mysqli_get_client_info();
+if (($tmp = $driver->client_info) !== $client_info) {
+ printf("[002] Expecting %s/%s, got %s/%s\n",
+ gettype($client_info), $client_info,
gettype($tmp), $tmp);
-
-
- $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT,
- MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF);
- $report_mode = $driver->report_mode;
- if (!is_int($report_mode))
- printf("[005] Expecting int/any, got %s/%s\n",
- gettype($report_mode), $report_mode);
-
- if (!in_array($report_mode, $all_modes))
- printf("[006] Illegal report mode returned? Got %s, expected %s\n",
- $report_mode, implode(', ', $all_modes));
-
- $driver->report_mode = MYSQLI_REPORT_STRICT;
- $ok = false;
- try {
-
- if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
-
- } catch (mysqli_sql_exception $e) {
- $ok = true;
- if ('' == $e->getMessage())
- printf("[008] getMessage() has returned an empty string.\n");
- if ('' == $e->getCode())
- printf("[009] getCode() has returned an empty string.\n");
- if ('' == $e->getFile())
- printf("[010] getFile() has returned an empty string.\n");
- if ('' == $e->getLine())
- printf("[011] getLine() has returned an empty string.\n");
- $tmp = $e->getTrace();
- if (empty($tmp))
- printf("[012] getTrace() has returned an empty array.\n");
- if ('' == $e->getTraceAsString())
- printf("[013] getTraceAsString() has returned an empty string.\n");
- if ('' == $e->__toString())
- printf("[014] __toString() has returned an empty string.\n");
-
+}
+
+$client_version = mysqli_get_client_version();
+if (($tmp = $driver->client_version) !== $client_version) {
+ printf("[003] Expecting %s/%s, got %s/%s\n",
+ gettype($client_version), $client_version,
+ gettype($tmp), $tmp);
+}
+
+$all_modes = [
+ MYSQLI_REPORT_ALL,
+ MYSQLI_REPORT_STRICT,
+ MYSQLI_REPORT_STRICT|MYSQLI_REPORT_ERROR,
+ MYSQLI_REPORT_STRICT|MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_ERROR,
+ MYSQLI_REPORT_ERROR|MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_OFF
+];
+$report_mode = $driver->report_mode;
+if (!is_int($report_mode)) {
+ printf("[005] Expecting int/any, got %s/%s\n",
+ gettype($report_mode), $report_mode);
+}
+
+if (!in_array($report_mode, $all_modes)) {
+ printf("[006] Illegal report mode returned? Got %s, expected %s\n",
+ $report_mode, implode(', ', $all_modes));
+}
+
+$driver->report_mode = MYSQLI_REPORT_STRICT;
+$ok = false;
+try {
+ if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) {
+ printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
}
- if (!$ok)
- printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n");
-
-
- $driver->report_mode = MYSQLI_REPORT_OFF;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_query($link, "NO_SQL");
mysqli_close($link);
+} catch (mysqli_sql_exception $e) {
+ $ok = true;
+ if ('' == $e->getMessage()) {
+ printf("[008] getMessage() has returned an empty string.\n");
+ }
+ if ('' == $e->getCode()) {
+ printf("[009] getCode() has returned an empty string.\n");
+ }
+ if ('' == $e->getFile()) {
+ printf("[010] getFile() has returned an empty string.\n");
+ }
+ if ('' == $e->getLine()) {
+ printf("[011] getLine() has returned an empty string.\n");
+ }
+ if ([] == $e->getTrace()) {
+ printf("[012] getTrace() has returned an empty array.\n");
+ }
+ if ('' == $e->getTraceAsString()) {
+ printf("[013] getTraceAsString() has returned an empty string.\n");
+ }
+ if ('' == $e->__toString()) {
+ printf("[014] __toString() has returned an empty string.\n");
+ }
+}
+if (!$ok) {
+ printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n");
+}
- $driver->report_mode = MYSQLI_REPORT_ERROR;
+$driver->report_mode = MYSQLI_REPORT_OFF;
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+}
+mysqli_query($link, "NO_SQL");
+mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_query($link, "NO_SQL");
- mysqli_close($link);
+$driver->report_mode = MYSQLI_REPORT_ERROR;
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+}
+mysqli_query($link, "NO_SQL");
+mysqli_close($link);
- if (MYSQLI_REPORT_ERROR !== $driver->report_mode)
- printf("[018] Error mode should be different\n");
+if (MYSQLI_REPORT_ERROR !== $driver->report_mode) {
+ printf("[018] Error reporting mode should be different\n");
+}
- /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */
+/* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */
- $driver->report_mode = $report_mode;
+$driver->report_mode = $report_mode;
- $reconnect = $driver->reconnect;
- if (!is_bool($reconnect))
+$reconnect = $driver->reconnect;
+if (!is_bool($reconnect)) {
printf("[019] Expecting boolean/any, got %s/%s\n",
- gettype($reconnect), $reconnect);
+ gettype($reconnect), $reconnect);
+}
- /* pointless, but I need more documentation */
- $driver->reconnect = true;
- $driver->reconnect = false;
- $driver->reconnect = $reconnect;
+/* pointless, but I need more documentation */
+$driver->reconnect = true;
+$driver->reconnect = false;
+$driver->reconnect = $reconnect;
- print "done!";
+print "done!";
?>
--EXPECTF--
Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'NO_SQL' at line 1 in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt
index ae99c2ca87..fac34e3d88 100644
--- a/ext/mysqli/tests/mysqli_fetch_all.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all.phpt
@@ -4,8 +4,6 @@ mysqli_fetch_all()
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
-if (!function_exists('mysqli_fetch_all'))
- die("skip: function only available with mysqlnd");
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
index df522f2eeb..ebdc55443c 100644
--- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
@@ -4,9 +4,6 @@ $mysqli->fetch_all() (introduced with mysqlnd)
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
-
-if (!function_exists('mysqli_fetch_all'))
- die("skip: function only available with mysqlnd");
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt
index 2018d75755..48d30453a0 100644
--- a/ext/mysqli/tests/mysqli_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field.phpt
@@ -35,10 +35,6 @@ require_once('skipifconnectfailure.inc');
printf("[004] Expecting charset %s/%d got %d\n",
$charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
}
- if ($tmp->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $tmp->max_length);
- }
if ($tmp->db != $db) {
printf("011] Expecting database '%s' got '%s'\n",
$db, $tmp->db);
@@ -97,7 +93,7 @@ object(stdClass)#%d (13) {
["catalog"]=>
string(%d) "%s"
["max_length"]=>
- int(1)
+ int(0)
["length"]=>
int(11)
["charsetnr"]=>
@@ -159,7 +155,7 @@ object(stdClass)#%d (13) {
["catalog"]=>
string(%d) "%s"
["max_length"]=>
- int(1)
+ int(0)
["length"]=>
int(11)
["charsetnr"]=>
diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
index d655e05a9c..ed0ce107cf 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
@@ -42,10 +42,6 @@ require_once('skipifconnectfailure.inc');
printf("[005] Expecting charset %s/%d got %d\n",
$charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
}
- if ($tmp->length != $charsetInfo->max_length) {
- printf("[006] Expecting length %d got %d\n",
- $charsetInfo->max_length, $tmp->max_length);
- }
if ($tmp->db != $db) {
printf("[007] Expecting database '%s' got '%s'\n",
$db, $tmp->db);
@@ -86,7 +82,7 @@ object(stdClass)#%d (13) {
["catalog"]=>
string(%d) "%s"
["max_length"]=>
- int(1)
+ int(0)
["length"]=>
int(11)
["charsetnr"]=>
diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt
index 7cfad35f87..ae1d12847a 100644
--- a/ext/mysqli/tests/mysqli_fetch_fields.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt
@@ -35,11 +35,6 @@ require_once('skipifconnectfailure.inc');
$charsetInfo->charset,
$charsetInfo->number, $field->charsetnr);
}
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length,
- $field->max_length);
- }
break;
}
}
@@ -76,7 +71,7 @@ object(stdClass)#%d (13) {
["catalog"]=>
string(%d) "%s"
["max_length"]=>
- int(1)
+ int(0)
["length"]=>
int(11)
["charsetnr"]=>
@@ -104,7 +99,7 @@ object(stdClass)#%d (13) {
["catalog"]=>
string(%d) "%s"
["max_length"]=>
- int(1)
+ int(0)
["length"]=>
int(%d)
["charsetnr"]=>
diff --git a/ext/mysqli/tests/mysqli_incomplete_initialization.phpt b/ext/mysqli/tests/mysqli_incomplete_initialization.phpt
index 533ea10af1..399ad74274 100644
--- a/ext/mysqli/tests/mysqli_incomplete_initialization.phpt
+++ b/ext/mysqli/tests/mysqli_incomplete_initialization.phpt
@@ -7,6 +7,7 @@ require_once('skipif.inc');
--FILE--
<?php
+mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = new mysqli();
@$mysqli->__construct('doesnotexist');
$mysqli->close();
diff --git a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
index 105b3276d3..1285fe1f50 100644
--- a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
+++ b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
@@ -113,5 +113,12 @@ memory_limit=256M
print "done!";
?>
+--CLEAN--
+<?php
+require_once 'connect.inc';
+$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
+$link->query('DROP TABLE test__mysqli_insert_packet_overflow');
+$link->close();
+?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt
index bec08cc1e1..d2c0fc6df6 100644
--- a/ext/mysqli/tests/mysqli_kill.phpt
+++ b/ext/mysqli/tests/mysqli_kill.phpt
@@ -11,9 +11,8 @@ require_once('skipifconnectfailure.inc');
require('table.inc');
- // Zend will cast the NULL to 0
try {
- mysqli_kill($link, null);
+ mysqli_kill($link, 0);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
diff --git a/ext/mysqli/tests/mysqli_local_infile_default_off.phpt b/ext/mysqli/tests/mysqli_local_infile_default_off.phpt
index c2e8aa2dc8..65f4012925 100644
--- a/ext/mysqli/tests/mysqli_local_infile_default_off.phpt
+++ b/ext/mysqli/tests/mysqli_local_infile_default_off.phpt
@@ -16,11 +16,11 @@ echo "server: ", $row['Value'], "\n";
mysqli_free_result($res);
mysqli_close($link);
-echo "connector: ", ini_get("mysqli.allow_local_infile"), "\n";
+echo 'connector: ', ini_get('mysqli.allow_local_infile'), ' ', var_export(ini_get('mysqli.local_infile_directory')), "\n";
print "done!\n";
?>
--EXPECTF--
server: %s
-connector: 0
+connector: 0 ''
done!
diff --git a/ext/mysqli/tests/mysqli_local_infile_directory_access_allowed.phpt b/ext/mysqli/tests/mysqli_local_infile_directory_access_allowed.phpt
new file mode 100644
index 0000000000..a9c0c82e99
--- /dev/null
+++ b/ext/mysqli/tests/mysqli_local_infile_directory_access_allowed.phpt
@@ -0,0 +1,80 @@
+--TEST--
+mysqli.local_infile_directory vs access allowed
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_allowed_by_server($link))
+ die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
+?>
+--INI--
+open_basedir={PWD}
+mysqli.allow_local_infile=0
+mysqli.local_infile_directory={PWD}/foo
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE test (id INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $filepath = str_replace('\\', '/', __DIR__.'/foo/foo.data');
+ if (!$link->query("LOAD DATA LOCAL INFILE '".$filepath."' INTO TABLE test")) {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $filepath = str_replace('\\', '/', __DIR__.'/foo/bar/bar.data');
+ if (!$link->query("LOAD DATA LOCAL INFILE '".$filepath."' INTO TABLE test")) {
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ $row_count = $row['num'];
+ $expected_row_count = 6;
+ if ($row_count != $expected_row_count) {
+ printf("[006] %d != %d\n", $row_count, $expected_row_count);
+ }
+ } else {
+ printf("[007] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $link->close();
+ echo "done";
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+$link->close();
+?>
+--EXPECT--
+done
diff --git a/ext/mysqli/tests/mysqli_local_infile_directory_access_denied.phpt b/ext/mysqli/tests/mysqli_local_infile_directory_access_denied.phpt
new file mode 100644
index 0000000000..8f50e03220
--- /dev/null
+++ b/ext/mysqli/tests/mysqli_local_infile_directory_access_denied.phpt
@@ -0,0 +1,65 @@
+--TEST--
+mysqli.local_infile_directory access denied
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_allowed_by_server($link))
+ die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
+?>
+--INI--
+open_basedir={PWD}
+mysqli.allow_local_infile=0
+mysqli.local_infile_directory={PWD}/foo/bar
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE test (id INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $filepath = str_replace('\\', '/', __DIR__.'/foo/foo.data');
+ if (!$link->query("LOAD DATA LOCAL INFILE '".$filepath."' INTO TABLE test")) {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ } else {
+ printf("[005] bug! should not happen - access denied expected\n");
+ }
+
+ $link->close();
+ echo "done";
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+$link->close();
+?>
+--EXPECTF--
+[004] [2068] LOAD DATA LOCAL INFILE %s
+done
diff --git a/ext/mysqli/tests/mysqli_local_infile_directory_vs_open_basedir.phpt b/ext/mysqli/tests/mysqli_local_infile_directory_vs_open_basedir.phpt
new file mode 100644
index 0000000000..a48606ad66
--- /dev/null
+++ b/ext/mysqli/tests/mysqli_local_infile_directory_vs_open_basedir.phpt
@@ -0,0 +1,65 @@
+--TEST--
+mysqli.local_infile_directory vs open_basedir
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_allowed_by_server($link))
+ die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
+?>
+--INI--
+open_basedir={PWD}
+mysqli.allow_local_infile=0
+mysqli.local_infile_directory={PWD}/../
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE test (id INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $filepath = str_replace('\\', '/', __DIR__.'/foo/foo.data');
+ if (!$link->query("LOAD DATA LOCAL INFILE '".$filepath."' INTO TABLE test")) {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ } else {
+ printf("[005] bug! should not happen - operation not permitted expected\n");
+ }
+
+ echo "done";
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+$link->close();
+?>
+--EXPECTF--
+Warning: mysqli_connect(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d
+[004] [2068] LOAD DATA LOCAL INFILE %s
+done
diff --git a/ext/mysqli/tests/mysqli_pam_sha256.phpt b/ext/mysqli/tests/mysqli_pam_sha256.phpt
index 8866409efe..7f94f202cc 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256.phpt
@@ -45,9 +45,8 @@ if (strlen($row['Value']) < 100) {
die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
}
-if (!$link->query("SET @@session.old_passwords=2")) {
- die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
-}
+// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
+$link->query("SET @@session.old_passwords=2");
$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
@@ -58,8 +57,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}
-if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
- !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
+ !$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}
@@ -75,6 +74,7 @@ if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db))
}
$link->close();
+echo "nocache";
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
index 86e27fbaff..f67d57ca75 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
@@ -57,10 +57,8 @@ if (strlen($key) != fwrite($fp, $key)) {
die(sprintf("skip Failed to create pub key file"));
}
-
-if (!$link->query("SET @@session.old_passwords=2")) {
- die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
-}
+// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
+$link->query("SET @@session.old_passwords=2");
$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
@@ -71,8 +69,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}
-if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
- !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
+ !$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}
@@ -88,6 +86,7 @@ if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db))
}
$link->close();
+echo "nocache";
?>
--INI--
mysqlnd.sha256_server_public_key="test_sha256_ini"
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
index 9b5639ff9a..a76feebf9f 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
@@ -54,10 +54,8 @@ if (strlen($row['Value']) != fwrite($fp, $row['Value'])) {
die(sprintf("skip Failed to create pub key file"));
}
-
-if (!$link->query("SET @@session.old_passwords=2")) {
- die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
-}
+// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
+$link->query("SET @@session.old_passwords=2");
$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
@@ -68,8 +66,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}
-if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
- !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
+ !$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}
@@ -85,6 +83,7 @@ if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db))
}
$link->close();
+echo "nocache";
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
index b664179265..9b2109d754 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
@@ -54,10 +54,8 @@ if (strlen($row['Value']) != fwrite($fp, $row['Value'])) {
die(sprintf("skip Failed to create pub key file"));
}
-
-if (!$link->query("SET @@session.old_passwords=2")) {
- die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
-}
+// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
+$link->query("SET @@session.old_passwords=2");
$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
@@ -68,8 +66,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}
-if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
- !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
+ !$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}
@@ -85,6 +83,7 @@ if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db))
}
$link->close();
+echo "nocache";
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/mysqli_phpinfo.phpt b/ext/mysqli/tests/mysqli_phpinfo.phpt
index fd0edd4463..ea78a6bb0c 100644
--- a/ext/mysqli/tests/mysqli_phpinfo.phpt
+++ b/ext/mysqli/tests/mysqli_phpinfo.phpt
@@ -46,7 +46,7 @@ require_once('skipifconnectfailure.inc');
if ($IS_MYSQLND) {
$expected = array(
'size',
- 'mysqli.allow_local_infile',
+ 'mysqli.allow_local_infile', 'mysqli.local_infile_directory',
'mysqli.allow_persistent', 'mysqli.max_persistent'
);
foreach ($expected as $k => $entry)
diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt
index b62418508f..6a5e1be912 100644
--- a/ext/mysqli/tests/mysqli_query_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_query_unicode.phpt
@@ -82,6 +82,14 @@ mysqli_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once 'connect.inc';
+$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
+$link->query('DROP PROCEDURE IF EXISTS процедурка');
+$link->query('DROP FUNCTION IF EXISTS функцийка');
+$link->close();
+?>
--EXPECTF--
array(1) {
["правилен"]=>
diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt
index f580037844..5a16863780 100644
--- a/ext/mysqli/tests/mysqli_real_connect.phpt
+++ b/ext/mysqli/tests/mysqli_real_connect.phpt
@@ -154,6 +154,8 @@ mysqli.allow_local_infile=1
--EXPECTF--
Warning: mysqli_real_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d
object(mysqli)#%d (%d) {
+ ["client_info"]=>
+ string(%d) "%s"
["client_version"]=>
int(%d)
["connect_errno"]=>
diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt
index 2e97cd45d7..be90b45794 100644
--- a/ext/mysqli/tests/mysqli_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_result_references.phpt
@@ -5,6 +5,8 @@ References to result sets
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
+--INI--
+opcache.enable=0
--FILE--
<?php
require_once('connect.inc');
@@ -85,60 +87,78 @@ array(7) refcount(2){
[0]=>
array(2) refcount(1){
["id"]=>
- int(1)
+ reference refcount(1) {
+ int(1)
+ }
["label"]=>
string(1) "a" refcount(%d)
}
[1]=>
array(2) refcount(1){
["id"]=>
- int(2)
+ reference refcount(1) {
+ int(2)
+ }
["label"]=>
string(1) "b" refcount(%d)
}
[2]=>
array(2) refcount(1){
["id"]=>
- int(1)
+ reference refcount(1) {
+ int(1)
+ }
["label"]=>
string(1) "a" refcount(%d)
}
[3]=>
array(2) refcount(1){
["id"]=>
- int(2)
+ reference refcount(1) {
+ int(2)
+ }
["label"]=>
string(1) "b" refcount(%d)
}
[4]=>
array(3) refcount(1){
["id"]=>
- &int(3)
+ reference refcount(2) {
+ int(3)
+ }
["label"]=>
string(1) "a" refcount(%d)
["id2"]=>
- &int(3)
+ reference refcount(2) {
+ int(3)
+ }
}
[5]=>
array(3) refcount(1){
["id"]=>
- &int(4)
+ reference refcount(2) {
+ int(4)
+ }
["label"]=>
string(1) "b" refcount(%d)
["id2"]=>
- &int(4)
+ reference refcount(2) {
+ int(4)
+ }
}
[6]=>
- &object(mysqli_result)#%d (0) refcount(%d){
+ reference refcount(2) {
+ object(mysqli_result)#2 (0) refcount(1){
+ }
}
}
array(1) refcount(2){
[0]=>
array(2) refcount(1){
["id"]=>
- string(1) "1" refcount(%d)
+ string(1) "1" interned
["label"]=>
- string(1) "a" refcount(%d)
+ string(1) "a" interned
}
}
done!
diff --git a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
index 3c44f8a309..5f5e352596 100644
--- a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
+++ b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
@@ -55,57 +55,71 @@ array(1) refcount(%d){
[0]=>
array(4) refcount(%d){
["row_ref"]=>
- &NULL
+ reference refcount(2) {
+ NULL
+ }
["row_copy"]=>
array(2) refcount(1){
["id"]=>
- string(1) "1" refcount(%d)
+ string(1) "1" interned
["label"]=>
- string(1) "a" refcount(%d)
+ string(1) "a" interned
}
["id_ref"]=>
- string(1) "1" refcount(%d)
+ reference refcount(1) {
+ string(1) "1" interned
+ }
["id_copy"]=>
- string(1) "1" refcount(%d)
+ string(1) "1" interned
}
}
array(2) refcount(%d){
[0]=>
array(4) refcount(%d){
["row_ref"]=>
- &NULL
+ reference refcount(2) {
+ NULL
+ }
["row_copy"]=>
array(2) refcount(%d){
["id"]=>
- string(1) "1" refcount(%d)
+ string(1) "1" interned
["label"]=>
- string(1) "a" refcount(%d)
+ string(1) "a" interned
}
["id_ref"]=>
- string(1) "1" refcount(%d)
+ reference refcount(1) {
+ string(1) "1" interned
+ }
["id_copy"]=>
- string(1) "1" refcount(%d)
+ string(1) "1" interned
}
[1]=>
array(5) refcount(%d){
["row_ref"]=>
- &array(2) refcount(%d){
- ["id"]=>
- &string(1) "2" refcount(%d)
- ["label"]=>
- string(1) "b" refcount(%d)
+ reference refcount(2) {
+ array(2) refcount(1){
+ ["id"]=>
+ reference refcount(2) {
+ string(1) "2" interned
+ }
+ ["label"]=>
+ string(1) "b" interned
+ }
}
["row_copy"]=>
array(2) refcount(%d){
["id"]=>
- string(1) "2" refcount(%d)
+ string(1) "2" interned
["label"]=>
- string(1) "b" refcount(%d)
+ string(1) "b" interned
}
["id_ref"]=>
- &string(1) "2" refcount(%d)
+ reference refcount(2) {
+ string(1) "2" interned
+ }
["id_copy"]=>
- string(1) "2" refcount(%d)
+ string(1) "2" interned
["id_copy_mod"]=>
int(2)
}
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
index 0edbc578e8..634faa01c3 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
@@ -61,7 +61,7 @@ require_once("connect.inc");
$res->close();
$stmt->close();
- // expecting max_length to _be_ set
+ // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH is no longer supported, expect no change in behavior.
$stmt = mysqli_stmt_init($link);
$stmt->prepare("SELECT label FROM test");
var_dump($stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1));
@@ -75,8 +75,8 @@ require_once("connect.inc");
$max_lengths = array();
foreach ($fields as $k => $meta) {
$max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length === 0)
- printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ if ($meta->max_length !== 0)
+ printf("[008] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
}
$res->close();
$stmt->close();
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
index 8ac3a049a1..91a8c0a556 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
@@ -291,23 +291,23 @@ string(1) "a"
reference, object, forward declaration...
int(1)
object(bar)#%d (2) {
- ["bar"]=>
- &string(1) "a"
["foo"]=>
&string(1) "a"
+ ["bar"]=>
+ &string(1) "a"
}
string(1) "a"
references, object, private...
int(1)
string(1) "a"
object(mega_bar)#5 (4) {
+ ["foo"]=>
+ &string(1) "a"
+ ["bar"]=>
+ &string(1) "a"
[%s]=>
&int(1)
["id_ref"]=>
&int(1)
- ["bar"]=>
- &string(1) "a"
- ["foo"]=>
- &string(1) "a"
}
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
index f2428aeb92..9a0e52d5cb 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
@@ -35,12 +35,12 @@ if (!function_exists('mysqli_stmt_get_result'))
printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n");
} else {
$found = false;
- foreach ($engines as $k => $engine)
- foreach ($engine as $k => $v)
- if (stristr($v, 'MyISAM')) {
- $found = true;
- break;
- }
+ foreach ($engines as $engine) {
+ if (stristr($engine[0], 'MyISAM')) {
+ $found = true;
+ break;
+ }
+ }
if (!$found)
printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n");
}
diff --git a/ext/mysqli/tests/mysqli_stmt_multires.phpt b/ext/mysqli/tests/mysqli_stmt_multires.phpt
index 73af79e2b1..07abac4dcc 100644
--- a/ext/mysqli/tests/mysqli_stmt_multires.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_multires.phpt
@@ -94,10 +94,10 @@ require_once('skipifconnectfailure.inc');
?>
--CLEAN--
<?php
- require_once("connect.inc");
- if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
- printf("[001] [%d] %s\n", $link->error, $link->errno);
- }
+require_once 'connect.inc';
+$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
+$link->query('DROP PROCEDURE IF EXISTS p123');
+$link->close();
?>
--EXPECT--
string(4) "pre:"
diff --git a/ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt b/ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt
index ed15d10e4a..c4d80498b1 100644
--- a/ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt
+++ b/ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt
@@ -71,6 +71,13 @@ while ($row = $result->fetch_assoc()) {
$stmt->next_result();
?>
+--CLEAN--
+<?php
+require_once 'connect.inc';
+$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
+$link->query('DROP PROCEDURE IF EXISTS testPs');
+$link->close();
+?>
--EXPECT--
use_result:
int(1)