mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
- Removed:
- UG(unicode) checks - Changed: - ZEND_STR_TYPE -> IS_UNICODE - convert_to_text -> convert_to_unicode
This commit is contained in:
parent
fe23a6b147
commit
04c90a0f51
13 changed files with 153 additions and 229 deletions
|
@ -625,6 +625,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
int hashed_details_length, port = MYSQL_PORT;
|
int hashed_details_length, port = MYSQL_PORT;
|
||||||
long client_flags = 0;
|
long client_flags = 0;
|
||||||
php_mysql_conn *mysql=NULL;
|
php_mysql_conn *mysql=NULL;
|
||||||
|
char *encoding = mysql_character_set_name(mysql->conn);
|
||||||
#if MYSQL_VERSION_ID <= 32230
|
#if MYSQL_VERSION_ID <= 32230
|
||||||
void (*handler) (int);
|
void (*handler) (int);
|
||||||
#endif
|
#endif
|
||||||
|
@ -757,9 +758,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
#else
|
#else
|
||||||
mysql->conn = mysql_init(persistent);
|
mysql->conn = mysql_init(persistent);
|
||||||
#endif
|
#endif
|
||||||
if (UG(unicode)) {
|
mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
|
||||||
mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connect_timeout != -1) {
|
if (connect_timeout != -1) {
|
||||||
mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
|
mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
|
||||||
|
@ -787,17 +786,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
|
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
|
||||||
|
|
||||||
#if !defined(MYSQL_USE_MYSQLND)
|
#if !defined(MYSQL_USE_MYSQLND)
|
||||||
if (UG(unicode)) {
|
|
||||||
#ifdef MYSQL_HAS_SET_CHARSET
|
#ifdef MYSQL_HAS_SET_CHARSET
|
||||||
mysql_set_character_set(mysql->conn, "utf8");
|
mysql_set_character_set(mysql->conn, "utf8");
|
||||||
#else
|
#else
|
||||||
char *encoding = mysql_character_set_name(mysql->conn);
|
if (strcasecmp((char*)encoding, "utf8")) {
|
||||||
if (strcasecmp((char*)encoding, "utf8")) {
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
|
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* hash it up */
|
/* hash it up */
|
||||||
|
@ -827,9 +823,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
#endif
|
#endif
|
||||||
if (mysql_ping(mysql->conn)) {
|
if (mysql_ping(mysql->conn)) {
|
||||||
if (mysql_errno(mysql->conn) == 2006) {
|
if (mysql_errno(mysql->conn) == 2006) {
|
||||||
if (UG(unicode)) {
|
mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
|
||||||
mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
|
|
||||||
}
|
|
||||||
#ifndef MYSQL_USE_MYSQLND
|
#ifndef MYSQL_USE_MYSQLND
|
||||||
if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
|
if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
|
||||||
#else
|
#else
|
||||||
|
@ -843,17 +837,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||||
}
|
}
|
||||||
#if !defined(MYSQL_USE_MYSQLND)
|
#if !defined(MYSQL_USE_MYSQLND)
|
||||||
if (UG(unicode)) {
|
|
||||||
#ifdef MYSQL_HAS_SET_CHARSET
|
#ifdef MYSQL_HAS_SET_CHARSET
|
||||||
mysql_set_character_set(mysql->conn, "utf8");
|
mysql_set_character_set(mysql->conn, "utf8");
|
||||||
#else
|
#else
|
||||||
char *encoding = mysql_character_set_name(mysql->conn);
|
if (strcasecmp((char*)encoding, "utf8")) {
|
||||||
if (strcasecmp((char*)encoding, "utf8")) {
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
|
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
|
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
|
||||||
}
|
}
|
||||||
|
@ -913,9 +904,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
mysql->conn = mysql_init(persistent);
|
mysql->conn = mysql_init(persistent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (UG(unicode)) {
|
mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
|
||||||
mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
|
|
||||||
}
|
|
||||||
if (connect_timeout != -1) {
|
if (connect_timeout != -1) {
|
||||||
mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
|
mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
|
||||||
}
|
}
|
||||||
|
@ -946,17 +936,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(MYSQL_USE_MYSQLND)
|
#if !defined(MYSQL_USE_MYSQLND)
|
||||||
if (UG(unicode)) {
|
|
||||||
#ifdef MYSQL_HAS_SET_CHARSET
|
#ifdef MYSQL_HAS_SET_CHARSET
|
||||||
mysql_set_character_set(mysql->conn, "utf8");
|
mysql_set_character_set(mysql->conn, "utf8");
|
||||||
#else
|
#else
|
||||||
char *encoding = mysql_character_set_name(mysql->conn);
|
if (strcasecmp((char*)encoding, "utf8")) {
|
||||||
if (strcasecmp((char*)encoding, "utf8")) {
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
|
MYSQL_DO_CONNECT_RETURN_FALSE();
|
||||||
MYSQL_DO_CONNECT_RETURN_FALSE();
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
|
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
|
||||||
|
|
||||||
|
@ -1284,7 +1271,7 @@ PHP_FUNCTION(mysql_set_charset)
|
||||||
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
|
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
|
||||||
|
|
||||||
/* Only allow the use of this function with unicode.semantics=On */
|
/* Only allow the use of this function with unicode.semantics=On */
|
||||||
if (UG(unicode) && (csname_len != 4 || strncasecmp(csname, "utf8", 4))) {
|
if (csname_len != 4 || strncasecmp(csname, "utf8", 4)) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Character set %s is not supported when running PHP with unicode.semantics=On.", csname);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Character set %s is not supported when running PHP with unicode.semantics=On.", csname);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2037,7 +2024,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||||
|
|
||||||
MAKE_STD_ZVAL(data);
|
MAKE_STD_ZVAL(data);
|
||||||
|
|
||||||
if (UG(unicode) && !IS_BINARY_DATA(mysql_field)) {
|
if (!IS_BINARY_DATA(mysql_field)) {
|
||||||
UChar *ustr;
|
UChar *ustr;
|
||||||
int ulen;
|
int ulen;
|
||||||
|
|
||||||
|
@ -2051,19 +2038,16 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||||
add_index_zval(return_value, i, data);
|
add_index_zval(return_value, i, data);
|
||||||
}
|
}
|
||||||
if (result_type & MYSQL_ASSOC) {
|
if (result_type & MYSQL_ASSOC) {
|
||||||
|
UChar *ustr;
|
||||||
|
int ulen;
|
||||||
|
|
||||||
if (result_type & MYSQL_NUM) {
|
if (result_type & MYSQL_NUM) {
|
||||||
Z_ADDREF_P(data);
|
Z_ADDREF_P(data);
|
||||||
}
|
}
|
||||||
if (UG(unicode)) {
|
|
||||||
UChar *ustr;
|
|
||||||
int ulen;
|
|
||||||
|
|
||||||
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
|
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
|
||||||
add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, data);
|
add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, data);
|
||||||
efree(ustr);
|
efree(ustr);
|
||||||
} else {
|
|
||||||
add_assoc_zval(return_value, mysql_field->name, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* NULL value. */
|
/* NULL value. */
|
||||||
|
@ -2072,16 +2056,12 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result_type & MYSQL_ASSOC) {
|
if (result_type & MYSQL_ASSOC) {
|
||||||
if (UG(unicode)) {
|
UChar *ustr;
|
||||||
UChar *ustr;
|
int ulen;
|
||||||
int ulen;
|
|
||||||
|
|
||||||
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
|
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
|
||||||
add_u_assoc_null_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1);
|
add_u_assoc_null_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1);
|
||||||
efree(ustr);
|
efree(ustr);
|
||||||
} else {
|
|
||||||
add_assoc_null(return_value, mysql_field->name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ static int le_pmysqli;
|
||||||
void php_mysqli_dtor_p_elements(void *data)
|
void php_mysqli_dtor_p_elements(void *data)
|
||||||
{
|
{
|
||||||
MYSQL *mysql = (MYSQL *) data;
|
MYSQL *mysql = (MYSQL *) data;
|
||||||
TSRMLS_FETCH();
|
|
||||||
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);
|
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,12 +338,12 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||||
if (member->type != IS_STRING && member->type != IS_UNICODE) {
|
if (member->type != IS_STRING && member->type != IS_UNICODE) {
|
||||||
tmp_member = *member;
|
tmp_member = *member;
|
||||||
zval_copy_ctor(&tmp_member);
|
zval_copy_ctor(&tmp_member);
|
||||||
convert_to_text(&tmp_member);
|
convert_to_unicode(&tmp_member);
|
||||||
member = &tmp_member;
|
member = &tmp_member;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->prop_handler != NULL) {
|
if (obj->prop_handler != NULL) {
|
||||||
ret = zend_u_hash_find(obj->prop_handler, ZEND_STR_TYPE, Z_UNIVAL_P(member), Z_UNILEN_P(member)+1, (void **) &hnd);
|
ret = zend_u_hash_find(obj->prop_handler, IS_UNICODE, Z_UNIVAL_P(member), Z_UNILEN_P(member)+1, (void **) &hnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == SUCCESS) {
|
if (ret == SUCCESS) {
|
||||||
|
@ -427,7 +427,7 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
|
||||||
if (member->type != IS_STRING && member->type != IS_UNICODE) {
|
if (member->type != IS_STRING && member->type != IS_UNICODE) {
|
||||||
tmp_member = *member;
|
tmp_member = *member;
|
||||||
zval_copy_ctor(&tmp_member);
|
zval_copy_ctor(&tmp_member);
|
||||||
convert_to_text(&tmp_member);
|
convert_to_unicode(&tmp_member);
|
||||||
member = &tmp_member;
|
member = &tmp_member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,9 +491,7 @@ HashTable * mysqli_object_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
|
||||||
zend_ascii_hash_add(retval, entry->name, entry->name_len + 1, &value, sizeof(zval *), NULL);
|
zend_ascii_hash_add(retval, entry->name, entry->name_len + 1, &value, sizeof(zval *), NULL);
|
||||||
}
|
}
|
||||||
zend_hash_move_forward_ex(props, &pos);
|
zend_hash_move_forward_ex(props, &pos);
|
||||||
if (UG(unicode)) {
|
zval_dtor(&member);
|
||||||
zval_dtor(&member);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*is_temp = 1;
|
*is_temp = 1;
|
||||||
|
@ -522,7 +520,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_
|
||||||
mysqli_base_class = mysqli_base_class->parent;
|
mysqli_base_class = mysqli_base_class->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
zend_u_hash_find(&classes, ZEND_STR_TYPE, mysqli_base_class->name, mysqli_base_class->name_length + 1,
|
zend_u_hash_find(&classes, IS_UNICODE, mysqli_base_class->name, mysqli_base_class->name_length + 1,
|
||||||
(void **) &intern->prop_handler);
|
(void **) &intern->prop_handler);
|
||||||
|
|
||||||
zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
|
||||||
|
@ -695,7 +693,7 @@ PHP_MINIT_FUNCTION(mysqli)
|
||||||
zend_u_hash_init(&mysqli_driver_properties, 0, NULL, NULL, 1, 1);
|
zend_u_hash_init(&mysqli_driver_properties, 0, NULL, NULL, 1, 1);
|
||||||
MYSQLI_ADD_PROPERTIES(&mysqli_driver_properties, mysqli_driver_property_entries);
|
MYSQLI_ADD_PROPERTIES(&mysqli_driver_properties, mysqli_driver_property_entries);
|
||||||
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_driver_property_info_entries);
|
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_driver_property_info_entries);
|
||||||
zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
|
zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
|
||||||
ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
|
ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
|
||||||
|
|
||||||
REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods);
|
REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods);
|
||||||
|
@ -703,7 +701,7 @@ PHP_MINIT_FUNCTION(mysqli)
|
||||||
zend_u_hash_init(&mysqli_link_properties, 0, NULL, NULL, 1, 1);
|
zend_u_hash_init(&mysqli_link_properties, 0, NULL, NULL, 1, 1);
|
||||||
MYSQLI_ADD_PROPERTIES(&mysqli_link_properties, mysqli_link_property_entries);
|
MYSQLI_ADD_PROPERTIES(&mysqli_link_properties, mysqli_link_property_entries);
|
||||||
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_link_property_info_entries);
|
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_link_property_info_entries);
|
||||||
zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
|
zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
|
||||||
|
|
||||||
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, mysqli_warning_methods);
|
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, mysqli_warning_methods);
|
||||||
ce = mysqli_warning_class_entry;
|
ce = mysqli_warning_class_entry;
|
||||||
|
@ -711,21 +709,21 @@ PHP_MINIT_FUNCTION(mysqli)
|
||||||
zend_u_hash_init(&mysqli_warning_properties, 0, NULL, NULL, 1, 1);
|
zend_u_hash_init(&mysqli_warning_properties, 0, NULL, NULL, 1, 1);
|
||||||
MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries);
|
MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries);
|
||||||
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_warning_property_info_entries);
|
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_warning_property_info_entries);
|
||||||
zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
|
zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
|
||||||
|
|
||||||
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, mysqli_result_methods);
|
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, mysqli_result_methods);
|
||||||
ce = mysqli_result_class_entry;
|
ce = mysqli_result_class_entry;
|
||||||
zend_u_hash_init(&mysqli_result_properties, 0, NULL, NULL, 1, 1);
|
zend_u_hash_init(&mysqli_result_properties, 0, NULL, NULL, 1, 1);
|
||||||
MYSQLI_ADD_PROPERTIES(&mysqli_result_properties, mysqli_result_property_entries);
|
MYSQLI_ADD_PROPERTIES(&mysqli_result_properties, mysqli_result_property_entries);
|
||||||
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_result_property_info_entries);
|
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_result_property_info_entries);
|
||||||
zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
|
zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
|
||||||
|
|
||||||
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, mysqli_stmt_methods);
|
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, mysqli_stmt_methods);
|
||||||
ce = mysqli_stmt_class_entry;
|
ce = mysqli_stmt_class_entry;
|
||||||
zend_u_hash_init(&mysqli_stmt_properties, 0, NULL, NULL, 1, 1);
|
zend_u_hash_init(&mysqli_stmt_properties, 0, NULL, NULL, 1, 1);
|
||||||
MYSQLI_ADD_PROPERTIES(&mysqli_stmt_properties, mysqli_stmt_property_entries);
|
MYSQLI_ADD_PROPERTIES(&mysqli_stmt_properties, mysqli_stmt_property_entries);
|
||||||
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_stmt_property_info_entries);
|
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_stmt_property_info_entries);
|
||||||
zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
|
zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
|
||||||
|
|
||||||
|
|
||||||
/* mysqli_options */
|
/* mysqli_options */
|
||||||
|
@ -1218,7 +1216,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||||
zval *res;
|
zval *res;
|
||||||
|
|
||||||
MAKE_STD_ZVAL(res);
|
MAKE_STD_ZVAL(res);
|
||||||
if (UG(unicode) && !IS_BINARY_DATA(fields[i])) {
|
if (!IS_BINARY_DATA(fields[i])) {
|
||||||
UChar *ustr;
|
UChar *ustr;
|
||||||
int ulen;
|
int ulen;
|
||||||
|
|
||||||
|
@ -1232,35 +1230,28 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||||
add_index_zval(return_value, i, res);
|
add_index_zval(return_value, i, res);
|
||||||
}
|
}
|
||||||
if (fetchtype & MYSQLI_ASSOC) {
|
if (fetchtype & MYSQLI_ASSOC) {
|
||||||
|
UChar *ustr;
|
||||||
|
int ulen;
|
||||||
|
|
||||||
if (fetchtype & MYSQLI_NUM) {
|
if (fetchtype & MYSQLI_NUM) {
|
||||||
Z_ADDREF_P(res);
|
Z_ADDREF_P(res);
|
||||||
}
|
}
|
||||||
if (UG(unicode)) {
|
|
||||||
UChar *ustr;
|
|
||||||
int ulen;
|
|
||||||
|
|
||||||
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
|
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
|
||||||
add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res);
|
add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res);
|
||||||
efree(ustr);
|
efree(ustr);
|
||||||
} else {
|
|
||||||
add_assoc_zval(return_value, fields[i].name, res);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fetchtype & MYSQLI_NUM) {
|
if (fetchtype & MYSQLI_NUM) {
|
||||||
add_index_null(return_value, i);
|
add_index_null(return_value, i);
|
||||||
}
|
}
|
||||||
if (fetchtype & MYSQLI_ASSOC) {
|
if (fetchtype & MYSQLI_ASSOC) {
|
||||||
if (UG(unicode)) {
|
UChar *ustr;
|
||||||
UChar *ustr;
|
int ulen;
|
||||||
int ulen;
|
|
||||||
|
|
||||||
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
|
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
|
||||||
add_u_assoc_null(return_value, IS_UNICODE, ZSTR(ustr));
|
add_u_assoc_null(return_value, IS_UNICODE, ZSTR(ustr));
|
||||||
efree(ustr);
|
efree(ustr);
|
||||||
} else {
|
|
||||||
add_assoc_null(return_value, fields[i].name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,9 +529,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change user resets the charset in the server, change it back */
|
/* Change user resets the charset in the server, change it back */
|
||||||
if (UG(unicode)) {
|
mysql_set_character_set(mysql->mysql, "utf8");
|
||||||
mysql_set_character_set(mysql->mysql, "utf8");
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -753,7 +751,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
|
||||||
zval *the_var = copies && copies[i]? copies[i]:stmt->param.vars[i];
|
zval *the_var = copies && copies[i]? copies[i]:stmt->param.vars[i];
|
||||||
switch (stmt->stmt->params[i].buffer_type) {
|
switch (stmt->stmt->params[i].buffer_type) {
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
if (UG(unicode) && Z_TYPE_P(the_var) == IS_UNICODE) {
|
if (Z_TYPE_P(the_var) == IS_UNICODE) {
|
||||||
if (the_var == stmt->param.vars[i]) {
|
if (the_var == stmt->param.vars[i]) {
|
||||||
php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
|
php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
|
||||||
the_var = copies[i];
|
the_var = copies[i];
|
||||||
|
@ -905,9 +903,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
|
||||||
tmp[10]= '\0';
|
tmp[10]= '\0';
|
||||||
/* unsigned int > INT_MAX is 10 digits - ALWAYS */
|
/* unsigned int > INT_MAX is 10 digits - ALWAYS */
|
||||||
ZVAL_UTF8_STRINGL(stmt->result.vars[i], tmp, 10, 0);
|
ZVAL_UTF8_STRINGL(stmt->result.vars[i], tmp, 10, 0);
|
||||||
if (UG(unicode)) {
|
efree(tmp);
|
||||||
efree(tmp);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1478,7 +1474,7 @@ PHP_FUNCTION(mysqli_set_local_infile_handler)
|
||||||
|
|
||||||
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
|
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
|
||||||
|
|
||||||
if (UG(unicode) && Z_TYPE_P(callback_func) != IS_ARRAY && Z_TYPE_P(callback_func) != IS_OBJECT) {
|
if (Z_TYPE_P(callback_func) != IS_ARRAY && Z_TYPE_P(callback_func) != IS_OBJECT) {
|
||||||
convert_to_string(callback_func);
|
convert_to_string(callback_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,10 +227,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||||
new_connection = TRUE;
|
new_connection = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UG(unicode)) {
|
mysql_options(mysql->mysql, MYSQL_SET_CHARSET_NAME, "utf8");
|
||||||
mysql_options(mysql->mysql, MYSQL_SET_CHARSET_NAME, "utf8");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_EMBEDDED_MYSQLI
|
#ifdef HAVE_EMBEDDED_MYSQLI
|
||||||
if (hostname_len) {
|
if (hostname_len) {
|
||||||
|
@ -260,9 +257,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when PHP runs in unicode, set default character set to utf8 */
|
/* when PHP runs in unicode, set default character set to utf8 */
|
||||||
if (UG(unicode)) {
|
mysql->conv = UG(utf8_conv);
|
||||||
mysql->conv = UG(utf8_conv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clear error */
|
/* clear error */
|
||||||
php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);
|
php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);
|
||||||
|
@ -947,7 +942,7 @@ PHP_FUNCTION(mysqli_set_charset)
|
||||||
|
|
||||||
/* check unicode modus */
|
/* check unicode modus */
|
||||||
/* todo: we need also to support UCS2. This will not work when using SET NAMES */
|
/* todo: we need also to support UCS2. This will not work when using SET NAMES */
|
||||||
if (UG(unicode) && (csname_len != 4 || strncasecmp(cs_name, "utf8", 4))) {
|
if (csname_len != 4 || strncasecmp(cs_name, "utf8", 4)) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Character set %s is not supported when running PHP with unicode.semantics=On.", cs_name);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Character set %s is not supported when running PHP with unicode.semantics=On.", cs_name);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1003,24 +998,14 @@ PHP_FUNCTION(mysqli_get_charset)
|
||||||
state = 1; /* all charsets are compiled in */
|
state = 1; /* all charsets are compiled in */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (UG(unicode)) {
|
add_property_utf8_string(return_value, "charset", (name) ? (char *)name : "", 1);
|
||||||
add_property_utf8_string(return_value, "charset", (name) ? (char *)name : "", 1);
|
add_property_utf8_string(return_value, "collation", (collation) ? (char *)collation : "", 1);
|
||||||
add_property_utf8_string(return_value, "collation", (collation) ? (char *)collation : "", 1);
|
add_property_utf8_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
|
||||||
add_property_utf8_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
|
|
||||||
} else {
|
|
||||||
add_property_string(return_value, "charset", (name) ? (char *)name : "", 1);
|
|
||||||
add_property_string(return_value, "collation",(collation) ? (char *)collation : "", 1);
|
|
||||||
add_property_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
|
|
||||||
}
|
|
||||||
add_property_long(return_value, "min_length", minlength);
|
add_property_long(return_value, "min_length", minlength);
|
||||||
add_property_long(return_value, "max_length", maxlength);
|
add_property_long(return_value, "max_length", maxlength);
|
||||||
add_property_long(return_value, "number", number);
|
add_property_long(return_value, "number", number);
|
||||||
add_property_long(return_value, "state", state);
|
add_property_long(return_value, "state", state);
|
||||||
if (UG(unicode)) {
|
add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
|
||||||
add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
|
|
||||||
} else {
|
|
||||||
add_property_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -663,12 +663,12 @@ PHPAPI MYSQLND *mysqlnd_connect(MYSQLND *conn,
|
||||||
(charset = mysqlnd_find_charset_name(conn->options.charset_name)))
|
(charset = mysqlnd_find_charset_name(conn->options.charset_name)))
|
||||||
{
|
{
|
||||||
auth_packet->charset_no = charset->nr;
|
auth_packet->charset_no = charset->nr;
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
|
||||||
} else if (UG(unicode)) {
|
|
||||||
auth_packet->charset_no = 200;/* utf8 - swedish collation, check mysqlnd_charset.c */
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
|
auth_packet->charset_no = 200;/* utf8 - swedish collation, check mysqlnd_charset.c */
|
||||||
|
#else
|
||||||
auth_packet->charset_no = greet_packet.charset_no;
|
auth_packet->charset_no = greet_packet.charset_no;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
auth_packet->db = db;
|
auth_packet->db = db;
|
||||||
auth_packet->db_len = db_len;
|
auth_packet->db_len = db_len;
|
||||||
|
|
|
@ -1107,6 +1107,7 @@ static int mysqlnd_build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list
|
||||||
TRACE_APPEND_STR("Array, ");
|
TRACE_APPEND_STR("Array, ");
|
||||||
break;
|
break;
|
||||||
case IS_OBJECT: {
|
case IS_OBJECT: {
|
||||||
|
zval tmp;
|
||||||
zstr class_name;
|
zstr class_name;
|
||||||
zend_uint class_name_len;
|
zend_uint class_name_len;
|
||||||
int dup;
|
int dup;
|
||||||
|
@ -1115,16 +1116,11 @@ static int mysqlnd_build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list
|
||||||
|
|
||||||
dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
|
dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
|
||||||
|
|
||||||
if (UG(unicode)) {
|
ZVAL_UNICODEL(&tmp, class_name.u, class_name_len, 1);
|
||||||
zval tmp;
|
convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv)));
|
||||||
|
TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp));
|
||||||
|
zval_dtor(&tmp);
|
||||||
|
|
||||||
ZVAL_UNICODEL(&tmp, class_name.u, class_name_len, 1);
|
|
||||||
convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv)));
|
|
||||||
TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp));
|
|
||||||
zval_dtor(&tmp);
|
|
||||||
} else {
|
|
||||||
TRACE_APPEND_STRL(class_name.s, class_name_len);
|
|
||||||
}
|
|
||||||
if(!dup) {
|
if(!dup) {
|
||||||
efree(class_name.v);
|
efree(class_name.v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,6 @@ char * mysqlnd_palloc_get_zval_name = "mysqlnd_palloc_get_zval";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION < 6
|
|
||||||
#define IS_UNICODE_DISABLED (1)
|
|
||||||
#else
|
|
||||||
#define IS_UNICODE_DISABLED (!UG(unicode))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* {{{ _mysqlnd_palloc_init_cache */
|
/* {{{ _mysqlnd_palloc_init_cache */
|
||||||
PHPAPI MYSQLND_ZVAL_PCACHE* _mysqlnd_palloc_init_cache(unsigned int cache_size TSRMLS_DC)
|
PHPAPI MYSQLND_ZVAL_PCACHE* _mysqlnd_palloc_init_cache(unsigned int cache_size TSRMLS_DC)
|
||||||
{
|
{
|
||||||
|
|
|
@ -685,7 +685,7 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT *stmt, zend_uchar **buf, zend_uch
|
||||||
#if PHP_MAJOR_VERSION < 6
|
#if PHP_MAJOR_VERSION < 6
|
||||||
if (Z_TYPE_P(the_var) != IS_STRING)
|
if (Z_TYPE_P(the_var) != IS_STRING)
|
||||||
#elif PHP_MAJOR_VERSION >= 6
|
#elif PHP_MAJOR_VERSION >= 6
|
||||||
if (Z_TYPE_P(the_var) != IS_STRING || (UG(unicode) && Z_TYPE_P(the_var) == IS_UNICODE))
|
if (Z_TYPE_P(the_var) != IS_STRING || Z_TYPE_P(the_var) == IS_UNICODE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (!copies || !copies[i]) {
|
if (!copies || !copies[i]) {
|
||||||
|
@ -693,7 +693,7 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT *stmt, zend_uchar **buf, zend_uch
|
||||||
}
|
}
|
||||||
the_var = copies[i];
|
the_var = copies[i];
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
if (UG(unicode) && Z_TYPE_P(the_var) == IS_UNICODE) {
|
if (Z_TYPE_P(the_var) == IS_UNICODE) {
|
||||||
zval_unicode_to_string_ex(the_var, UG(utf8_conv) TSRMLS_CC);
|
zval_unicode_to_string_ex(the_var, UG(utf8_conv) TSRMLS_CC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -910,21 +910,18 @@ mysqlnd_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int flag
|
||||||
*/
|
*/
|
||||||
if (zend_hash_key->is_numeric == FALSE) {
|
if (zend_hash_key->is_numeric == FALSE) {
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
if (UG(unicode)) {
|
zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
|
||||||
zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
|
zend_hash_key->ustr,
|
||||||
zend_hash_key->ustr,
|
zend_hash_key->ulen + 1,
|
||||||
zend_hash_key->ulen + 1,
|
zend_hash_key->key,
|
||||||
zend_hash_key->key,
|
(void *) &data, sizeof(zval *), NULL);
|
||||||
(void *) &data, sizeof(zval *), NULL);
|
#else
|
||||||
} else
|
zend_hash_quick_update(Z_ARRVAL_P(row),
|
||||||
|
field->name,
|
||||||
|
field->name_length + 1,
|
||||||
|
zend_hash_key->key,
|
||||||
|
(void *) &data, sizeof(zval *), NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
zend_hash_quick_update(Z_ARRVAL_P(row),
|
|
||||||
field->name,
|
|
||||||
field->name_length + 1,
|
|
||||||
zend_hash_key->key,
|
|
||||||
(void *) &data, sizeof(zval *), NULL);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
zend_hash_index_update(Z_ARRVAL_P(row),
|
zend_hash_index_update(Z_ARRVAL_P(row),
|
||||||
zend_hash_key->key,
|
zend_hash_key->key,
|
||||||
|
@ -1143,21 +1140,18 @@ mysqlnd_fetch_row_buffered(MYSQLND_RES *result, void *param, unsigned int flags,
|
||||||
*/
|
*/
|
||||||
if (zend_hash_key->is_numeric == FALSE) {
|
if (zend_hash_key->is_numeric == FALSE) {
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
if (UG(unicode)) {
|
zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
|
||||||
zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
|
zend_hash_key->ustr,
|
||||||
zend_hash_key->ustr,
|
zend_hash_key->ulen + 1,
|
||||||
zend_hash_key->ulen + 1,
|
zend_hash_key->key,
|
||||||
zend_hash_key->key,
|
(void *) &data, sizeof(zval *), NULL);
|
||||||
(void *) &data, sizeof(zval *), NULL);
|
#else
|
||||||
} else
|
zend_hash_quick_update(Z_ARRVAL_P(row),
|
||||||
|
field->name,
|
||||||
|
field->name_length + 1,
|
||||||
|
zend_hash_key->key,
|
||||||
|
(void *) &data, sizeof(zval *), NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
zend_hash_quick_update(Z_ARRVAL_P(row),
|
|
||||||
field->name,
|
|
||||||
field->name_length + 1,
|
|
||||||
zend_hash_key->key,
|
|
||||||
(void *) &data, sizeof(zval *), NULL);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
zend_hash_index_update(Z_ARRVAL_P(row),
|
zend_hash_index_update(Z_ARRVAL_P(row),
|
||||||
zend_hash_key->key,
|
zend_hash_key->key,
|
||||||
|
@ -1419,21 +1413,18 @@ mysqlnd_fetch_row_async_buffered(MYSQLND_RES *result, void *param, unsigned int
|
||||||
*/
|
*/
|
||||||
if (result->meta->zend_hash_keys[i].is_numeric == FALSE) {
|
if (result->meta->zend_hash_keys[i].is_numeric == FALSE) {
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
if (UG(unicode)) {
|
zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
|
||||||
zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
|
result->meta->zend_hash_keys[i].ustr,
|
||||||
result->meta->zend_hash_keys[i].ustr,
|
result->meta->zend_hash_keys[i].ulen + 1,
|
||||||
result->meta->zend_hash_keys[i].ulen + 1,
|
result->meta->zend_hash_keys[i].key,
|
||||||
result->meta->zend_hash_keys[i].key,
|
(void *) &data, sizeof(zval *), NULL);
|
||||||
(void *) &data, sizeof(zval *), NULL);
|
#else
|
||||||
} else
|
zend_hash_quick_update(Z_ARRVAL_P(row),
|
||||||
|
result->meta->fields[i].name,
|
||||||
|
result->meta->fields[i].name_length + 1,
|
||||||
|
result->meta->zend_hash_keys[i].key,
|
||||||
|
(void *) &data, sizeof(zval *), NULL);
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
zend_hash_quick_update(Z_ARRVAL_P(row),
|
|
||||||
result->meta->fields[i].name,
|
|
||||||
result->meta->fields[i].name_length + 1,
|
|
||||||
result->meta->zend_hash_keys[i].key,
|
|
||||||
(void *) &data, sizeof(zval *), NULL);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
zend_hash_index_update(Z_ARRVAL_P(row),
|
zend_hash_index_update(Z_ARRVAL_P(row),
|
||||||
result->meta->zend_hash_keys[i].key,
|
result->meta->zend_hash_keys[i].key,
|
||||||
|
|
|
@ -143,6 +143,8 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
php_mysql_packet_res_field field_packet;
|
php_mysql_packet_res_field field_packet;
|
||||||
|
UChar *ustr;
|
||||||
|
int ulen;
|
||||||
|
|
||||||
DBG_ENTER("mysqlnd_res_meta::read_metadata");
|
DBG_ENTER("mysqlnd_res_meta::read_metadata");
|
||||||
|
|
||||||
|
@ -212,39 +214,33 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
if (UG(unicode)) {
|
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen,
|
||||||
UChar *ustr;
|
meta->fields[i].name,
|
||||||
int ulen;
|
meta->fields[i].name_length TSRMLS_CC);
|
||||||
zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen,
|
if ((meta->zend_hash_keys[i].is_numeric =
|
||||||
meta->fields[i].name,
|
mysqlnd_unicode_is_key_numeric(ustr, ulen + 1, &idx)))
|
||||||
meta->fields[i].name_length TSRMLS_CC);
|
|
||||||
if ((meta->zend_hash_keys[i].is_numeric =
|
|
||||||
mysqlnd_unicode_is_key_numeric(ustr, ulen + 1, &idx)))
|
|
||||||
{
|
|
||||||
meta->zend_hash_keys[i].key = idx;
|
|
||||||
mnd_efree(ustr);
|
|
||||||
} else {
|
|
||||||
meta->zend_hash_keys[i].ustr.u = ustr;
|
|
||||||
meta->zend_hash_keys[i].ulen = ulen;
|
|
||||||
meta->zend_hash_keys[i].key = zend_u_get_hash_value(IS_UNICODE, ZSTR(ustr), ulen + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* For BC we have to check whether the key is numeric and use it like this */
|
meta->zend_hash_keys[i].key = idx;
|
||||||
if ((meta->zend_hash_keys[i].is_numeric =
|
mnd_efree(ustr);
|
||||||
mysqlnd_is_key_numeric(field_packet.metadata->name,
|
} else {
|
||||||
field_packet.metadata->name_length + 1,
|
meta->zend_hash_keys[i].ustr.u = ustr;
|
||||||
&idx)))
|
meta->zend_hash_keys[i].ulen = ulen;
|
||||||
{
|
meta->zend_hash_keys[i].key = zend_u_get_hash_value(IS_UNICODE, ZSTR(ustr), ulen + 1);
|
||||||
meta->zend_hash_keys[i].key = idx;
|
|
||||||
} else {
|
|
||||||
meta->zend_hash_keys[i].key =
|
|
||||||
zend_get_hash_value(field_packet.metadata->name,
|
|
||||||
field_packet.metadata->name_length + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* For BC we have to check whether the key is numeric and use it like this */
|
||||||
|
if ((meta->zend_hash_keys[i].is_numeric =
|
||||||
|
mysqlnd_is_key_numeric(field_packet.metadata->name,
|
||||||
|
field_packet.metadata->name_length + 1,
|
||||||
|
&idx)))
|
||||||
|
{
|
||||||
|
meta->zend_hash_keys[i].key = idx;
|
||||||
|
} else {
|
||||||
|
meta->zend_hash_keys[i].key =
|
||||||
|
zend_get_hash_value(field_packet.metadata->name,
|
||||||
|
field_packet.metadata->name_length + 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
PACKET_FREE_ALLOCA(field_packet);
|
PACKET_FREE_ALLOCA(field_packet);
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, zval *return_value TS
|
||||||
|
|
||||||
sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
|
sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
|
||||||
#if PHP_MAJOR_VERSION >= 6
|
#if PHP_MAJOR_VERSION >= 6
|
||||||
if (UG(unicode)) {
|
{
|
||||||
UChar *ustr, *tstr;
|
UChar *ustr, *tstr;
|
||||||
int ulen, tlen;
|
int ulen, tlen;
|
||||||
|
|
||||||
|
@ -178,12 +178,11 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, zval *return_value TS
|
||||||
add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1);
|
add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1);
|
||||||
efree(ustr);
|
efree(ustr);
|
||||||
efree(tstr);
|
efree(tstr);
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
add_assoc_string_ex(return_value, mysqlnd_stats_values_names[i].s,
|
|
||||||
mysqlnd_stats_values_names[i].l + 1, tmp, 1);
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
add_assoc_string_ex(return_value, mysqlnd_stats_values_names[i].s,
|
||||||
|
mysqlnd_stats_values_names[i].l + 1, tmp, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
|
@ -50,25 +50,22 @@ PHPAPI void mysqlnd_minfo_print_hash(zval *values)
|
||||||
zstr string_key;
|
zstr string_key;
|
||||||
uint string_key_len;
|
uint string_key_len;
|
||||||
ulong num_key;
|
ulong num_key;
|
||||||
|
int s_len;
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
|
|
||||||
|
|
||||||
TSRMLS_FETCH();
|
TSRMLS_FETCH();
|
||||||
|
|
||||||
zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, &string_key_len, &num_key, 0, &pos_values);
|
zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, &string_key_len, &num_key, 0, &pos_values);
|
||||||
|
|
||||||
convert_to_string(*values_entry);
|
convert_to_string(*values_entry);
|
||||||
|
|
||||||
if (UG(unicode)) {
|
if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
|
||||||
int s_len;
|
&s, &s_len, string_key.u, string_key_len TSRMLS_CC) == SUCCESS) {
|
||||||
if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
|
php_info_print_table_row(2, s, Z_STRVAL_PP(values_entry));
|
||||||
&s, &s_len, string_key.u, string_key_len TSRMLS_CC) == SUCCESS) {
|
}
|
||||||
php_info_print_table_row(2, s, Z_STRVAL_PP(values_entry));
|
if (s) {
|
||||||
}
|
mnd_efree(s);
|
||||||
if (s) {
|
|
||||||
mnd_efree(s);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
php_info_print_table_row(2, string_key.s, Z_STRVAL_PP(values_entry));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values);
|
zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values);
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||||
|
|
||||||
if (is_callable_replace) {
|
if (is_callable_replace) {
|
||||||
if (Z_TYPE_P(replace) != IS_ARRAY && Z_TYPE_P(replace) != IS_OBJECT) {
|
if (Z_TYPE_P(replace) != IS_ARRAY && Z_TYPE_P(replace) != IS_OBJECT) {
|
||||||
convert_to_text(replace);
|
convert_to_unicode(replace);
|
||||||
}
|
}
|
||||||
if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) {
|
if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue