- win32 build now has libcurl v7.16.0
[m6w6/ext-http] / http_querystring_api.c
index 45aa5acc7666a26cbe5575cbbd1312ce5fac9ebe..4c45664b5aacbdcf982a32ef866c67719a2945b5 100644 (file)
@@ -16,7 +16,7 @@
 #include "php_http.h"
 
 #include "php_variables.h"
-#ifdef HAVE_ICONV
+#ifdef HTTP_HAVE_ICONV
 #      undef PHP_ATOM_INC
 #      include "ext/iconv/php_iconv.h"
 #      include "ext/standard/url.h"
@@ -38,7 +38,7 @@ static inline int _http_querystring_modify_array_ex(zval *qarray, int key_type,
 static inline int _http_querystring_modify_array(zval *qarray, zval *params TSRMLS_DC);
 
 
-#ifdef HAVE_ICONV
+#ifdef HTTP_HAVE_ICONV
 PHP_HTTP_API int _http_querystring_xlate(zval *array, zval *param, const char *ie, const char *oe TSRMLS_DC)
 {
        HashPosition pos;
@@ -154,7 +154,8 @@ static inline int _http_querystring_modify_array(zval *qarray, zval *params TSRM
        zval **params_entry = NULL;
        
        FOREACH_KEYLENVAL(pos, params, key, keylen, idx, params_entry) {
-               if (http_querystring_modify_array_ex(qarray, key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG, key, keylen, idx, *params_entry)) {
+               /* only public properties */
+               if ((!key || *key) && http_querystring_modify_array_ex(qarray, key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG, key, keylen, idx, *params_entry)) {
                        rv = 1;
                }
                key = NULL;
@@ -182,8 +183,8 @@ static inline int _http_querystring_modify_array_ex(zval *qarray, int key_type,
                zval equal;
                
                /* recursive */
-               if (Z_TYPE_P(params_entry) == IS_ARRAY) {
-                       return http_querystring_modify_array(*qarray_entry, params_entry);
+               if (Z_TYPE_P(params_entry) == IS_ARRAY || Z_TYPE_P(params_entry) == IS_OBJECT) {
+                       return http_querystring_modify(*qarray_entry, params_entry);
                }
                /* equal */
                if ((SUCCESS == is_equal_function(&equal, *qarray_entry, params_entry TSRMLS_CC)) && Z_BVAL(equal)) {
@@ -193,6 +194,9 @@ static inline int _http_querystring_modify_array_ex(zval *qarray, int key_type,
        
        /* add */
        ZVAL_ADDREF(params_entry);
+       if (Z_TYPE_P(params_entry) == IS_OBJECT) {
+               convert_to_array_ex(&params_entry);
+       }
        if (key_type == HASH_KEY_IS_STRING) {
                add_assoc_zval_ex(qarray, key, keylen, params_entry);
        } else {