From: Michael Wallner Date: Mon, 30 Jan 2006 14:55:45 +0000 (+0000) Subject: - make sure queryArray is actually an array X-Git-Tag: RELEASE_0_22_0~13 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7489cd801f25fd08bcba22545fd4c89223709ebe;p=m6w6%2Fext-http - make sure queryArray is actually an array --- diff --git a/http_querystring_object.c b/http_querystring_object.c index 7195459..e6daf67 100644 --- a/http_querystring_object.c +++ b/http_querystring_object.c @@ -275,7 +275,7 @@ PHP_METHOD(HttpQueryString, get) if (name && name_len) { zval **arrval, *qarray = GET_PROP(queryArray); - if (SUCCESS == zend_hash_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void **) &arrval)) { + if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_hash_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void **) &arrval))) { RETVAL_ZVAL(*arrval, 1, 0); if (ztype) { @@ -357,25 +357,27 @@ PHP_METHOD(HttpQueryString, del) if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶ms)) { zval *qarray = GET_PROP(queryArray); - if (Z_TYPE_P(params) == IS_ARRAY) { - HashPosition pos; - zval **name; - - FOREACH_VAL(pos, params, name) { - ZVAL_ADDREF(*name); - convert_to_string_ex(name); - zend_hash_del(Z_ARRVAL_P(qarray), Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1); - zval_ptr_dtor(name); - } - - http_querystring_update(qarray, GET_PROP(queryString)); - } else { - ZVAL_ADDREF(params); - convert_to_string_ex(¶ms); - if (SUCCESS == zend_hash_del(Z_ARRVAL_P(qarray), Z_STRVAL_P(params), Z_STRLEN_P(params) + 1)) { + if (Z_TYPE_P(qarray) == IS_ARRAY) { + if (Z_TYPE_P(params) == IS_ARRAY) { + HashPosition pos; + zval **name; + + FOREACH_VAL(pos, params, name) { + ZVAL_ADDREF(*name); + convert_to_string_ex(name); + zend_hash_del(Z_ARRVAL_P(qarray), Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1); + zval_ptr_dtor(name); + } + http_querystring_update(qarray, GET_PROP(queryString)); + } else { + ZVAL_ADDREF(params); + convert_to_string_ex(¶ms); + if (SUCCESS == zend_hash_del(Z_ARRVAL_P(qarray), Z_STRVAL_P(params), Z_STRLEN_P(params) + 1)) { + http_querystring_update(qarray, GET_PROP(queryString)); + } + zval_ptr_dtor(¶ms); } - zval_ptr_dtor(¶ms); } } IF_RETVAL_USED {