+PHP_HTTP_API int _http_querystring_modify(zval *qarray, zval *params TSRMLS_DC)
+{
+ if (Z_TYPE_P(params) == IS_ARRAY) {
+ return http_querystring_modify_array(qarray, params);
+ } else if (Z_TYPE_P(params) == IS_OBJECT) {
+#ifdef ZEND_ENGINE_2
+ if (!instanceof_function(Z_OBJCE_P(params), http_querystring_object_ce TSRMLS_CC)) {
+#endif
+ zval temp_array;
+ INIT_ZARR(temp_array, HASH_OF(params));
+ return http_querystring_modify_array(qarray, &temp_array);
+#ifdef ZEND_ENGINE_2
+ }
+ return http_querystring_modify_array(qarray, GET_PROP_EX(params, queryArray));
+#endif
+ } else {
+ int rv;
+ zval array;
+
+ INIT_PZVAL(&array);
+ array_init(&array);
+
+ ZVAL_ADDREF(params);
+ convert_to_string_ex(¶ms);
+ sapi_module.treat_data(PARSE_STRING, estrdup(Z_STRVAL_P(params)), &array TSRMLS_CC);
+ zval_ptr_dtor(¶ms);
+ rv = http_querystring_modify_array(qarray, &array);
+ zval_dtor(&array);
+ return rv;
+ }
+}
+
+static inline int _http_querystring_modify_array(zval *qarray, zval *params TSRMLS_DC)
+{
+ int rv = 0;
+ HashKey key = initHashKey(0);
+ HashPosition pos;
+ zval **params_entry = NULL;
+
+ FOREACH_KEYVAL(pos, params, key, params_entry) {
+ /* only public properties */
+ if ((key.type != HASH_KEY_IS_STRING || *key.str) && http_querystring_modify_array_ex(qarray, key.type, key.str, key.len, key.num, *params_entry)) {
+ rv = 1;
+ }
+ }
+
+ return rv;
+}
+
+static inline int _http_querystring_modify_array_ex(zval *qarray, int key_type, char *key, int keylen, ulong idx, zval *params_entry TSRMLS_DC)