felipe Fri Mar 27 19:28:27 2009 UTC Modified files: /php-src/ext/mysql php_mysql.c /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c /php-src/ext/mysqlnd mysqlnd.c mysqlnd_debug.c mysqlnd_palloc.c mysqlnd_ps_codec.c mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_statistics.c php_mysqlnd.c /php-src/ext/pcre php_pcre.c Log: - Removed: - UG(unicode) checks - Changed: - ZEND_STR_TYPE -> IS_UNICODE - convert_to_text -> convert_to_unicode
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.274&r2=1.275&diff_format=u Index: php-src/ext/mysql/php_mysql.c diff -u php-src/ext/mysql/php_mysql.c:1.274 php-src/ext/mysql/php_mysql.c:1.275 --- php-src/ext/mysql/php_mysql.c:1.274 Wed Mar 25 10:27:21 2009 +++ php-src/ext/mysql/php_mysql.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mysql.c,v 1.274 2009/03/25 10:27:21 johannes Exp $ */ +/* $Id: php_mysql.c,v 1.275 2009/03/27 19:28:26 felipe Exp $ */ /* TODO: * @@ -625,6 +625,7 @@ int hashed_details_length, port = MYSQL_PORT; long client_flags = 0; php_mysql_conn *mysql=NULL; + char *encoding = mysql_character_set_name(mysql->conn); #if MYSQL_VERSION_ID <= 32230 void (*handler) (int); #endif @@ -757,9 +758,7 @@ #else mysql->conn = mysql_init(persistent); #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) { mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); @@ -787,17 +786,14 @@ mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); #if !defined(MYSQL_USE_MYSQLND) - if (UG(unicode)) { #ifdef MYSQL_HAS_SET_CHARSET - mysql_set_character_set(mysql->conn, "utf8"); + mysql_set_character_set(mysql->conn, "utf8"); #else - char *encoding = mysql_character_set_name(mysql->conn); - 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); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } + 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); + MYSQL_DO_CONNECT_RETURN_FALSE(); + } #endif - } #endif /* hash it up */ @@ -827,9 +823,7 @@ #endif if (mysql_ping(mysql->conn)) { 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 if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) #else @@ -843,17 +837,14 @@ MYSQL_DO_CONNECT_RETURN_FALSE(); } #if !defined(MYSQL_USE_MYSQLND) - if (UG(unicode)) { #ifdef MYSQL_HAS_SET_CHARSET - mysql_set_character_set(mysql->conn, "utf8"); + mysql_set_character_set(mysql->conn, "utf8"); #else - char *encoding = mysql_character_set_name(mysql->conn); - 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); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } + 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); + MYSQL_DO_CONNECT_RETURN_FALSE(); + } #endif - } #endif mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); } @@ -913,9 +904,8 @@ mysql->conn = mysql_init(persistent); #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) { mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); } @@ -946,17 +936,14 @@ } #if !defined(MYSQL_USE_MYSQLND) - if (UG(unicode)) { #ifdef MYSQL_HAS_SET_CHARSET - mysql_set_character_set(mysql->conn, "utf8"); + mysql_set_character_set(mysql->conn, "utf8"); #else - char *encoding = mysql_character_set_name(mysql->conn); - 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); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } + 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); + MYSQL_DO_CONNECT_RETURN_FALSE(); + } #endif - } #endif mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); @@ -1284,7 +1271,7 @@ 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 */ - 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); RETURN_FALSE; } @@ -2037,7 +2024,7 @@ MAKE_STD_ZVAL(data); - if (UG(unicode) && !IS_BINARY_DATA(mysql_field)) { + if (!IS_BINARY_DATA(mysql_field)) { UChar *ustr; int ulen; @@ -2051,19 +2038,16 @@ add_index_zval(return_value, i, data); } if (result_type & MYSQL_ASSOC) { + UChar *ustr; + int ulen; + if (result_type & MYSQL_NUM) { 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); - add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, data); - efree(ustr); - } else { - add_assoc_zval(return_value, mysql_field->name, data); - } + + 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); + efree(ustr); } } else { /* NULL value. */ @@ -2072,16 +2056,12 @@ } if (result_type & MYSQL_ASSOC) { - 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); - add_u_assoc_null_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1); - efree(ustr); - } else { - add_assoc_null(return_value, mysql_field->name); - } + UChar *ustr; + int ulen; + + 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); + efree(ustr); } } } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.143&r2=1.144&diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.143 php-src/ext/mysqli/mysqli.c:1.144 --- php-src/ext/mysqli/mysqli.c:1.143 Thu Jan 22 20:57:32 2009 +++ php-src/ext/mysqli/mysqli.c Fri Mar 27 19:28:26 2009 @@ -17,7 +17,7 @@ | Ulf Wendel <u...@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli.c,v 1.143 2009/01/22 20:57:32 johannes Exp $ + $Id: mysqli.c,v 1.144 2009/03/27 19:28:26 felipe Exp $ */ #ifdef HAVE_CONFIG_H @@ -95,7 +95,7 @@ void php_mysqli_dtor_p_elements(void *data) { MYSQL *mysql = (MYSQL *) data; - TSRMLS_FETCH(); + mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT); } @@ -338,12 +338,12 @@ if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } 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) { @@ -427,7 +427,7 @@ if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -491,9 +491,7 @@ zend_ascii_hash_add(retval, entry->name, entry->name_len + 1, &value, sizeof(zval *), NULL); } zend_hash_move_forward_ex(props, &pos); - if (UG(unicode)) { - zval_dtor(&member); - } + zval_dtor(&member); } *is_temp = 1; @@ -522,7 +520,7 @@ 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); zend_object_std_init(&intern->zo, class_type TSRMLS_CC); @@ -695,7 +693,7 @@ 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_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; REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods); @@ -703,7 +701,7 @@ 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_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); ce = mysqli_warning_class_entry; @@ -711,21 +709,21 @@ 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_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); ce = mysqli_result_class_entry; 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_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); ce = mysqli_stmt_class_entry; 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_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 */ @@ -1218,7 +1216,7 @@ zval *res; MAKE_STD_ZVAL(res); - if (UG(unicode) && !IS_BINARY_DATA(fields[i])) { + if (!IS_BINARY_DATA(fields[i])) { UChar *ustr; int ulen; @@ -1232,35 +1230,28 @@ add_index_zval(return_value, i, res); } if (fetchtype & MYSQLI_ASSOC) { + UChar *ustr; + int ulen; + if (fetchtype & MYSQLI_NUM) { 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); - add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res); - efree(ustr); - } else { - add_assoc_zval(return_value, fields[i].name, res); - } + + 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); + efree(ustr); } } else { if (fetchtype & MYSQLI_NUM) { add_index_null(return_value, i); } if (fetchtype & MYSQLI_ASSOC) { - 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); - add_u_assoc_null(return_value, IS_UNICODE, ZSTR(ustr)); - efree(ustr); - } else { - add_assoc_null(return_value, fields[i].name); - } + UChar *ustr; + int ulen; + + 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)); + efree(ustr); } } } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.172&r2=1.173&diff_format=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.172 php-src/ext/mysqli/mysqli_api.c:1.173 --- php-src/ext/mysqli/mysqli_api.c:1.172 Thu Jan 22 20:57:32 2009 +++ php-src/ext/mysqli/mysqli_api.c Fri Mar 27 19:28:26 2009 @@ -17,7 +17,7 @@ | Ulf Wendel <u...@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.172 2009/01/22 20:57:32 johannes Exp $ + $Id: mysqli_api.c,v 1.173 2009/03/27 19:28:26 felipe Exp $ */ #ifdef HAVE_CONFIG_H @@ -529,9 +529,7 @@ } /* 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; } @@ -753,7 +751,7 @@ zval *the_var = copies && copies[i]? copies[i]:stmt->param.vars[i]; switch (stmt->stmt->params[i].buffer_type) { 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]) { php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i); the_var = copies[i]; @@ -905,9 +903,7 @@ tmp[10]= '\0'; /* unsigned int > INT_MAX is 10 digits - ALWAYS */ ZVAL_UTF8_STRINGL(stmt->result.vars[i], tmp, 10, 0); - if (UG(unicode)) { - efree(tmp); - } + efree(tmp); break; } #endif @@ -1478,7 +1474,7 @@ 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); } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.92&r2=1.93&diff_format=u Index: php-src/ext/mysqli/mysqli_nonapi.c diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.92 php-src/ext/mysqli/mysqli_nonapi.c:1.93 --- php-src/ext/mysqli/mysqli_nonapi.c:1.92 Tue Jan 27 15:35:22 2009 +++ php-src/ext/mysqli/mysqli_nonapi.c Fri Mar 27 19:28:26 2009 @@ -17,7 +17,7 @@ | Ulf Wendel <u...@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli_nonapi.c,v 1.92 2009/01/27 15:35:22 johannes Exp $ + $Id: mysqli_nonapi.c,v 1.93 2009/03/27 19:28:26 felipe Exp $ */ #ifdef HAVE_CONFIG_H @@ -227,10 +227,7 @@ 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 if (hostname_len) { @@ -260,9 +257,7 @@ } /* 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 */ php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC); @@ -947,7 +942,7 @@ /* check unicode modus */ /* 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); RETURN_FALSE; } @@ -1003,24 +998,14 @@ state = 1; /* all charsets are compiled in */ #endif - if (UG(unicode)) { - 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, "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_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, "dir", (dir) ? (char *)dir : "", 1); add_property_long(return_value, "min_length", minlength); add_property_long(return_value, "max_length", maxlength); add_property_long(return_value, "number", number); add_property_long(return_value, "state", state); - if (UG(unicode)) { - add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1); - } else { - add_property_string(return_value, "comment", (comment) ? (char *)comment : "", 1); - } + add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1); } /* }}} */ #endif http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd.c?r1=1.38&r2=1.39&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd.c diff -u php-src/ext/mysqlnd/mysqlnd.c:1.38 php-src/ext/mysqlnd/mysqlnd.c:1.39 --- php-src/ext/mysqlnd/mysqlnd.c:1.38 Mon Feb 16 17:25:37 2009 +++ php-src/ext/mysqlnd/mysqlnd.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd.c,v 1.38 2009/02/16 17:25:37 johannes Exp $ */ +/* $Id: mysqlnd.c,v 1.39 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" @@ -663,12 +663,12 @@ (charset = mysqlnd_find_charset_name(conn->options.charset_name))) { 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 { +#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; +#endif } auth_packet->db = db; auth_packet->db_len = db_len; http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_debug.c?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_debug.c diff -u php-src/ext/mysqlnd/mysqlnd_debug.c:1.12 php-src/ext/mysqlnd/mysqlnd_debug.c:1.13 --- php-src/ext/mysqlnd/mysqlnd_debug.c:1.12 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/mysqlnd_debug.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_debug.c,v 1.12 2008/12/31 11:12:33 sebastian Exp $ */ +/* $Id: mysqlnd_debug.c,v 1.13 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" @@ -1107,6 +1107,7 @@ TRACE_APPEND_STR("Array, "); break; case IS_OBJECT: { + zval tmp; zstr class_name; zend_uint class_name_len; int dup; @@ -1115,16 +1116,11 @@ dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC); - if (UG(unicode)) { - zval 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); - 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) { efree(class_name.v); } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_palloc.c?r1=1.15&r2=1.16&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_palloc.c diff -u php-src/ext/mysqlnd/mysqlnd_palloc.c:1.15 php-src/ext/mysqlnd/mysqlnd_palloc.c:1.16 --- php-src/ext/mysqlnd/mysqlnd_palloc.c:1.15 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/mysqlnd_palloc.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_palloc.c,v 1.15 2008/12/31 11:12:33 sebastian Exp $ */ +/* $Id: mysqlnd_palloc.c,v 1.16 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_priv.h" @@ -39,13 +39,6 @@ #endif -#if PHP_MAJOR_VERSION < 6 -#define IS_UNICODE_DISABLED (1) -#else -#define IS_UNICODE_DISABLED (!UG(unicode)) -#endif - - /* {{{ _mysqlnd_palloc_init_cache */ PHPAPI MYSQLND_ZVAL_PCACHE* _mysqlnd_palloc_init_cache(unsigned int cache_size TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_ps_codec.c?r1=1.15&r2=1.16&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_ps_codec.c diff -u php-src/ext/mysqlnd/mysqlnd_ps_codec.c:1.15 php-src/ext/mysqlnd/mysqlnd_ps_codec.c:1.16 --- php-src/ext/mysqlnd/mysqlnd_ps_codec.c:1.15 Mon Feb 16 17:25:37 2009 +++ php-src/ext/mysqlnd/mysqlnd_ps_codec.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_ps_codec.c,v 1.15 2009/02/16 17:25:37 johannes Exp $ */ +/* $Id: mysqlnd_ps_codec.c,v 1.16 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" @@ -685,7 +685,7 @@ #if PHP_MAJOR_VERSION < 6 if (Z_TYPE_P(the_var) != IS_STRING) #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 { if (!copies || !copies[i]) { @@ -693,7 +693,7 @@ } the_var = copies[i]; #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); } #endif http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_result.c?r1=1.29&r2=1.30&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_result.c diff -u php-src/ext/mysqlnd/mysqlnd_result.c:1.29 php-src/ext/mysqlnd/mysqlnd_result.c:1.30 --- php-src/ext/mysqlnd/mysqlnd_result.c:1.29 Tue Mar 17 09:51:04 2009 +++ php-src/ext/mysqlnd/mysqlnd_result.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_result.c,v 1.29 2009/03/17 09:51:04 andrey Exp $ */ +/* $Id: mysqlnd_result.c,v 1.30 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" @@ -910,21 +910,18 @@ */ if (zend_hash_key->is_numeric == FALSE) { #if PHP_MAJOR_VERSION >= 6 - if (UG(unicode)) { - zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE, - zend_hash_key->ustr, - zend_hash_key->ulen + 1, - zend_hash_key->key, - (void *) &data, sizeof(zval *), NULL); - } else -#endif - { - zend_hash_quick_update(Z_ARRVAL_P(row), - field->name, - field->name_length + 1, - zend_hash_key->key, - (void *) &data, sizeof(zval *), NULL); - } + zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE, + zend_hash_key->ustr, + zend_hash_key->ulen + 1, + zend_hash_key->key, + (void *) &data, sizeof(zval *), NULL); +#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 } else { zend_hash_index_update(Z_ARRVAL_P(row), zend_hash_key->key, @@ -1143,21 +1140,18 @@ */ if (zend_hash_key->is_numeric == FALSE) { #if PHP_MAJOR_VERSION >= 6 - if (UG(unicode)) { - zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE, - zend_hash_key->ustr, - zend_hash_key->ulen + 1, - zend_hash_key->key, - (void *) &data, sizeof(zval *), NULL); - } else + zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE, + zend_hash_key->ustr, + zend_hash_key->ulen + 1, + zend_hash_key->key, + (void *) &data, sizeof(zval *), NULL); +#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 - { - zend_hash_quick_update(Z_ARRVAL_P(row), - field->name, - field->name_length + 1, - zend_hash_key->key, - (void *) &data, sizeof(zval *), NULL); - } } else { zend_hash_index_update(Z_ARRVAL_P(row), zend_hash_key->key, @@ -1419,21 +1413,18 @@ */ if (result->meta->zend_hash_keys[i].is_numeric == FALSE) { #if PHP_MAJOR_VERSION >= 6 - if (UG(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].ulen + 1, - result->meta->zend_hash_keys[i].key, - (void *) &data, sizeof(zval *), NULL); - } else + zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE, + result->meta->zend_hash_keys[i].ustr, + result->meta->zend_hash_keys[i].ulen + 1, + result->meta->zend_hash_keys[i].key, + (void *) &data, sizeof(zval *), NULL); +#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 - { - 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 { zend_hash_index_update(Z_ARRVAL_P(row), result->meta->zend_hash_keys[i].key, http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_result_meta.c?r1=1.10&r2=1.11&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_result_meta.c diff -u php-src/ext/mysqlnd/mysqlnd_result_meta.c:1.10 php-src/ext/mysqlnd/mysqlnd_result_meta.c:1.11 --- php-src/ext/mysqlnd/mysqlnd_result_meta.c:1.10 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/mysqlnd_result_meta.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_result_meta.c,v 1.10 2008/12/31 11:12:33 sebastian Exp $ */ +/* $Id: mysqlnd_result_meta.c,v 1.11 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_priv.h" @@ -143,6 +143,8 @@ { unsigned int i = 0; php_mysql_packet_res_field field_packet; + UChar *ustr; + int ulen; DBG_ENTER("mysqlnd_res_meta::read_metadata"); @@ -212,39 +214,33 @@ } #if PHP_MAJOR_VERSION >= 6 - if (UG(unicode)) { - UChar *ustr; - int ulen; - zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, - meta->fields[i].name, - 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 + zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, + meta->fields[i].name, + meta->fields[i].name_length TSRMLS_CC); + if ((meta->zend_hash_keys[i].is_numeric = + mysqlnd_unicode_is_key_numeric(ustr, ulen + 1, &idx))) { - /* 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); - } + 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 + /* 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); http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_statistics.c?r1=1.10&r2=1.11&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_statistics.c diff -u php-src/ext/mysqlnd/mysqlnd_statistics.c:1.10 php-src/ext/mysqlnd/mysqlnd_statistics.c:1.11 --- php-src/ext/mysqlnd/mysqlnd_statistics.c:1.10 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/mysqlnd_statistics.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_statistics.c,v 1.10 2008/12/31 11:12:33 sebastian Exp $ */ +/* $Id: mysqlnd_statistics.c,v 1.11 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_priv.h" @@ -168,7 +168,7 @@ sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]); #if PHP_MAJOR_VERSION >= 6 - if (UG(unicode)) { + { UChar *ustr, *tstr; int ulen, tlen; @@ -178,12 +178,11 @@ add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1); efree(ustr); 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 } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/php_mysqlnd.c?r1=1.11&r2=1.12&diff_format=u Index: php-src/ext/mysqlnd/php_mysqlnd.c diff -u php-src/ext/mysqlnd/php_mysqlnd.c:1.11 php-src/ext/mysqlnd/php_mysqlnd.c:1.12 --- php-src/ext/mysqlnd/php_mysqlnd.c:1.11 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/php_mysqlnd.c Fri Mar 27 19:28:26 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mysqlnd.c,v 1.11 2008/12/31 11:12:33 sebastian Exp $ */ +/* $Id: php_mysqlnd.c,v 1.12 2009/03/27 19:28:26 felipe Exp $ */ #include "php.h" #include "php_ini.h" #include "mysqlnd.h" @@ -50,25 +50,22 @@ zstr string_key; uint string_key_len; ulong num_key; + int s_len; char *s = NULL; + TSRMLS_FETCH(); 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); - - if (UG(unicode)) { - int s_len; - if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), - &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); - } - } else { - php_info_print_table_row(2, string_key.s, Z_STRVAL_PP(values_entry)); + + if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), + &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); } zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values); http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.248&r2=1.249&diff_format=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.248 php-src/ext/pcre/php_pcre.c:1.249 --- php-src/ext/pcre/php_pcre.c:1.248 Thu Mar 26 20:01:57 2009 +++ php-src/ext/pcre/php_pcre.c Fri Mar 27 19:28:26 2009 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.248 2009/03/26 20:01:57 felipe Exp $ */ +/* $Id: php_pcre.c,v 1.249 2009/03/27 19:28:26 felipe Exp $ */ /* TODO * php_pcre_replace_impl(): @@ -1437,7 +1437,7 @@ if (is_callable_replace) { 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)) { 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 CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php