better fix for robs issue
[m6w6/ext-http] / http_message_object.c
index 6d271ba9b0c22f436de22e60b181eb450eb3b253..70bf7f0c06385ae58a04ea11f60c72e7d46b6a6f 100644 (file)
@@ -802,7 +802,7 @@ PHP_METHOD(HttpMessage, setBody)
        
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &body, &len)) {
                phpstr_dtor(PHPSTR(obj->message));
-               phpstr_from_string_ex(PHPSTR(obj->message), body, len);         
+               phpstr_from_string_ex(PHPSTR(obj->message), body, len);
        }
 }
 /* }}} */
@@ -1276,6 +1276,7 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
                                zval_ptr_dtor(&array);
                                
                                if (PHPSTR_VAL(obj->message) && PHPSTR_LEN(obj->message)) {
+                                       phpstr_fix(PHPSTR(obj->message));
                                        INIT_PZVAL(&body);
                                        ZVAL_STRINGL(&body, PHPSTR_VAL(obj->message), PHPSTR_LEN(obj->message), 0);
                                        if (method != HTTP_POST) {
@@ -1287,6 +1288,7 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
                                                zval_copy_ctor(&body);
                                                sapi_module.treat_data(PARSE_STRING, Z_STRVAL(body), &post TSRMLS_CC);
                                                zend_call_method_with_1_params(&return_value, http_request_object_ce, NULL, "setpostfields", NULL, &post);
+                                               zval_dtor(&post);
                                        }
                                }
 #else