iliaa Fri Dec 8 00:46:01 2006 UTC Modified files: /php-src/ext/curl interface.c Log: Allow POST of unicode data as utf8 http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.99&r2=1.100&diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.99 php-src/ext/curl/interface.c:1.100 --- php-src/ext/curl/interface.c:1.99 Thu Dec 7 01:06:54 2006 +++ php-src/ext/curl/interface.c Fri Dec 8 00:46:01 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interface.c,v 1.99 2006/12/07 01:06:54 iliaa Exp $ */ +/* $Id: interface.c,v 1.100 2006/12/08 00:46:01 iliaa Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -957,7 +957,7 @@ error = call_user_function(EG(function_table), NULL, func, retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION"); - } else if (Z_TYPE_P(retval) == IS_STRING || Z_TYPE_(retval) == IS_UNICODE) { + } else if (Z_TYPE_P(retval) == IS_STRING || Z_TYPE_P(retval) == IS_UNICODE) { if (Z_TYPE_(retval) == IS_UNICODE) { convert_to_string_ex(retval); } @@ -1449,13 +1449,19 @@ int ntype; int l; UErrorCode status = U_ZERO_ERROR; + uint data_len; SEPARATE_ZVAL(current); - convert_to_string_ex(current); + + if (Z_TYPE_PP(current) == IS_UNICODE) { + zend_unicode_to_string_ex(UG(utf8_conv), &postval, &data_len, Z_USTRVAL_PP(current), Z_USTRLEN_PP(current), &status); + } else { + convert_to_string_ex(current); + postval = Z_STRVAL_PP(current); + data_len = Z_STRLEN_PP(current); + } zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL); - - postval = Z_STRVAL_PP(current); ntype = zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL); if (type == -1) { @@ -1499,7 +1505,7 @@ CURLFORM_COPYNAME, key, CURLFORM_NAMELENGTH, l, CURLFORM_COPYCONTENTS, postval, - CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_PP(current), + CURLFORM_CONTENTSLENGTH, (long)data_len, CURLFORM_END); } if (ntype == HASH_KEY_IS_UNICODE) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php