From: Michael Wallner Date: Thu, 12 Feb 2009 13:47:14 +0000 (+0000) Subject: MFH: 1.7 bugfixes X-Git-Tag: RELEASE_1_6_3~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=4335ae84338de0949883027c565fb680b9461a38;p=m6w6%2Fext-http MFH: 1.7 bugfixes --- diff --git a/http_deflatestream_object.c b/http_deflatestream_object.c index 01e8ae2..ad3bfb7 100644 --- a/http_deflatestream_object.c +++ b/http_deflatestream_object.c @@ -242,8 +242,10 @@ PHP_METHOD(HttpDeflateStream, flush) STR_FREE(encoded); updated_len += encoded_len; RETURN_STRINGL(updated, updated_len, 0); - } else { + } else if (encoded) { RETVAL_STRINGL(encoded, encoded_len, 0); + } else { + RETVAL_NULL(); } } else { RETVAL_FALSE; diff --git a/http_inflatestream_object.c b/http_inflatestream_object.c index acd1257..6872943 100644 --- a/http_inflatestream_object.c +++ b/http_inflatestream_object.c @@ -263,9 +263,11 @@ PHP_METHOD(HttpInflateStream, finish) STR_FREE(decoded); updated_len += decoded_len; RETVAL_STRINGL(updated, updated_len, 0); - } else { + } else if (decoded) { STR_FREE(updated); RETVAL_STRINGL(decoded, decoded_len, 0); + } else { + RETVAL_NULL(); } } else { STR_FREE(updated); diff --git a/http_message_object.c b/http_message_object.c index d01c256..8845681 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -393,6 +393,10 @@ void _http_message_object_free(zend_object *object TSRMLS_DC) { http_message_object *o = (http_message_object *) object; + if (o->iterator) { + zval_ptr_dtor(&o->iterator); + o->iterator = NULL; + } if (o->message) { http_message_dtor(o->message); efree(o->message); @@ -1132,9 +1136,9 @@ PHP_METHOD(HttpMessage, setHttpVersion) } convert_to_double(zv); - sprintf(v, "%1.1lf", Z_DVAL_P(zv)); + snprintf(v, sizeof(v), "%1.1f", Z_DVAL_P(zv)); if (strcmp(v, "1.0") && strcmp(v, "1.1")) { - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid HTTP protocol version (1.0 or 1.1): %s", v); + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid HTTP protocol version (1.0 or 1.1): %g", Z_DVAL_P(zv)); RETURN_FALSE; } diff --git a/http_request_object.c b/http_request_object.c index 310772a..75f5136 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -745,7 +745,7 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this static int apply_pretty_key(void *pDest, int num_args, va_list args, zend_hash_key *hash_key) { - if (hash_key->nKeyLength > 1) { + if (hash_key->arKey && hash_key->nKeyLength > 1) { hash_key->h = zend_hash_func(pretty_key(hash_key->arKey, hash_key->nKeyLength - 1, 1, 0), hash_key->nKeyLength); } return ZEND_HASH_APPLY_KEEP;