iliaa Sat Dec 9 14:37:40 2006 UTC Modified files: /php-src/ext/curl interface.c Log: Improve handling of POST data with Andrei's help. http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.102&r2=1.103&diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.102 php-src/ext/curl/interface.c:1.103 --- php-src/ext/curl/interface.c:1.102 Sat Dec 9 14:07:13 2006 +++ php-src/ext/curl/interface.c Sat Dec 9 14:37:40 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interface.c,v 1.102 2006/12/09 14:07:13 bjori Exp $ */ +/* $Id: interface.c,v 1.103 2006/12/09 14:37:40 iliaa Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -1451,22 +1451,36 @@ UErrorCode status = U_ZERO_ERROR; uint data_len; - SEPARATE_ZVAL(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); + switch (Z_TYPE_PP(current)) { + case IS_UNICODE: + ntype = HASH_KEY_IS_UNICODE; + break; + case IS_STRING: + ntype = HASH_KEY_IS_STRING; + break; + default: + if (type != -1) { + ntype = type; + } else { + ntype = HASH_KEY_IS_STRING; + } + break; } - zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL); - - ntype = zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL); if (type == -1) { type = ntype; } else if (type != ntype) { + goto type_conflict; + } + + SEPARATE_ZVAL(current); + convert_to_string_with_converter_ex(current, UG(utf8_conv)); + postval = Z_STRVAL_PP(current); + data_len = Z_STRLEN_PP(current); + + ntype = zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL); + if (type != ntype && ntype != HASH_KEY_IS_LONG) { +type_conflict: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Form parameters must either be all unicode or all binary"); continue; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php