MFH: 1.7 bugfixes
authorMichael Wallner <mike@php.net>
Thu, 12 Feb 2009 13:47:14 +0000 (13:47 +0000)
committerMichael Wallner <mike@php.net>
Thu, 12 Feb 2009 13:47:14 +0000 (13:47 +0000)
http_deflatestream_object.c
http_inflatestream_object.c
http_message_object.c
http_request_object.c

index 01e8ae2c8e7058afb7aacfb972909bd7b1515d01..ad3bfb765a55afe58899a7d2949571fd21fc81cd 100644 (file)
@@ -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;
index acd1257e03332db22fda5dd71e296f12cbbdc960..68729436ee78c78d1c0abf02e08fb6b646c4f419 100644 (file)
@@ -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);
index d01c256ed32e3efd63977f548b38760f48341c74..88456812d7bffa33eb2f780c9b57455ce5b5cc0f 100644 (file)
@@ -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;
        }
 
index 310772a7e6b6724f76f0ff1273be35132884a4f7..75f5136c675ad6aa9ac9c5feb7b9ed362efc423b 100644 (file)
@@ -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;