@@ -1451,22 +1451,36 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
1451
1451
UErrorCode status = U_ZERO_ERROR ;
1452
1452
uint data_len ;
1453
1453
1454
- SEPARATE_ZVAL (current );
1455
-
1456
- if (Z_TYPE_PP (current ) == IS_UNICODE ) {
1457
- zend_unicode_to_string_ex (UG (utf8_conv ), & postval , & data_len , Z_USTRVAL_PP (current ), Z_USTRLEN_PP (current ), & status );
1458
- } else {
1459
- convert_to_string_ex (current );
1460
- postval = Z_STRVAL_PP (current );
1461
- data_len = Z_STRLEN_PP (current );
1454
+ switch (Z_TYPE_PP (current )) {
1455
+ case IS_UNICODE :
1456
+ ntype = HASH_KEY_IS_UNICODE ;
1457
+ break ;
1458
+ case IS_STRING :
1459
+ ntype = HASH_KEY_IS_STRING ;
1460
+ break ;
1461
+ default :
1462
+ if (type != -1 ) {
1463
+ ntype = type ;
1464
+ } else {
1465
+ ntype = HASH_KEY_IS_STRING ;
1466
+ }
1467
+ break ;
1462
1468
}
1463
1469
1464
- zend_hash_get_current_key_ex (postfields , & string_key , & string_key_len , & num_key , 0 , NULL );
1465
-
1466
- ntype = zend_hash_get_current_key_ex (postfields , & string_key , & string_key_len , & num_key , 0 , NULL );
1467
1470
if (type == -1 ) {
1468
1471
type = ntype ;
1469
1472
} else if (type != ntype ) {
1473
+ goto type_conflict ;
1474
+ }
1475
+
1476
+ SEPARATE_ZVAL (current );
1477
+ convert_to_string_with_converter_ex (current , UG (utf8_conv ));
1478
+ postval = Z_STRVAL_PP (current );
1479
+ data_len = Z_STRLEN_PP (current );
1480
+
1481
+ ntype = zend_hash_get_current_key_ex (postfields , & string_key , & string_key_len , & num_key , 0 , NULL );
1482
+ if (type != ntype && ntype != HASH_KEY_IS_LONG ) {
1483
+ type_conflict :
1470
1484
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Form parameters must either be all unicode or all binary" );
1471
1485
continue ;
1472
1486
}
0 commit comments