+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)) {
+ return http_querystring_modify_array(qarray, zend_read_property(THIS_CE, params, ZEND_STRS("queryArray")-1, 0 TSRMLS_CC));
+ } else {
+#endif
+ return http_querystring_modify_array(qarray, params);
+#ifdef ZEND_ENGINE_2
+ }
+#endif
+ } else {
+ int rv;
+ zval array;
+ zval *qstring = http_zsep(IS_STRING, params);
+
+ INIT_PZVAL(&array);
+ array_init(&array);
+
+ sapi_module.treat_data(PARSE_STRING, estrdup(Z_STRVAL_P(qstring)), &array TSRMLS_CC);
+ zval_ptr_dtor(&qstring);
+
+ 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_HASH_KEYVAL(pos, HASH_OF(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)