X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_querystring_api.c;h=7caa7bcf92ebca441d05f54417a792bd4a7656f1;hp=5d636a3ed20cea4f757ce8e9c7b85a46a699addd;hb=refs%2Fheads%2Fv1.7.x;hpb=23d7e7f276852b4ed1bd2829fcca38c6db854563 diff --git a/http_querystring_api.c b/http_querystring_api.c index 5d636a3..7caa7bc 100644 --- a/http_querystring_api.c +++ b/http_querystring_api.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2007, Michael Wallner | + | Copyright (c) 2004-2010, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -127,14 +127,14 @@ PHP_HTTP_API int _http_querystring_modify(zval *qarray, zval *params TSRMLS_DC) } else { int rv; zval array; + zval *qstring = http_zsep(IS_STRING, params); 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); + 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; @@ -161,6 +161,11 @@ static inline int _http_querystring_modify_array(zval *qarray, zval *params TSRM static inline int _http_querystring_modify_array_ex(zval *qarray, int key_type, char *key, int keylen, ulong idx, zval *params_entry TSRMLS_DC) { zval **qarray_entry; + + /* ensure array type */ + if (Z_TYPE_P(qarray) != IS_ARRAY) { + convert_to_array(qarray); + } /* delete */ if (Z_TYPE_P(params_entry) == IS_NULL) {