coverity fix
[m6w6/ext-http] / src / php_http_params.c
index c0071ac430aa690e934898e922d83fae62268c07..90710684deabe6d08bd5e81d8e1563086f0095a6 100644 (file)
@@ -470,7 +470,7 @@ static void merge_param(HashTable *params, zval *zdata, zval ***current_param, z
                        while (Z_TYPE_PP(zdata_ptr) == IS_ARRAY
                        &&      SUCCESS == zend_hash_get_current_data(Z_ARRVAL_PP(zdata_ptr), (void *) &test_ptr)
                        ) {
-                               if (Z_TYPE_PP(test_ptr) == IS_ARRAY) {
+                               if (Z_TYPE_PP(test_ptr) == IS_ARRAY && Z_TYPE_PP(ptr) == IS_ARRAY) {
 
                                        /* now find key in ptr */
                                        if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_PP(zdata_ptr), &hkey.str, &hkey.len, &hkey.num, hkey.dup, NULL)) {
@@ -522,12 +522,10 @@ static void merge_param(HashTable *params, zval *zdata, zval ***current_param, z
 
 static void push_param(HashTable *params, php_http_params_state_t *state, const php_http_params_opts_t *opts TSRMLS_DC)
 {
-       if (!state->current.val) {
-               return;
-       }
-
        if (state->val.str) {
-               if (0 < (state->val.len = state->input.str - state->val.str)) {
+               if (!state->current.val) {
+                       return;
+               } else if (0 < (state->val.len = state->input.str - state->val.str)) {
                        sanitize_value(opts->flags, state->val.str, state->val.len, *(state->current.val), state->rfc5987 TSRMLS_CC);
                } else {
                        ZVAL_EMPTY_STRING(*(state->current.val));