From: Michael Wallner Date: Sat, 14 Jan 2012 13:59:56 +0000 (+0000) Subject: fix http\message\Body::toCallback X-Git-Tag: DEV_2-before-client~71 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=aba384d552ef79668427db4c5b904229ff7b169f;p=m6w6%2Fext-http fix http\message\Body::toCallback --- diff --git a/php_http_message_body.c b/php_http_message_body.c index b2d4ff8..14486a9 100644 --- a/php_http_message_body.c +++ b/php_http_message_body.c @@ -554,8 +554,8 @@ PHP_METHOD(HttpMessageBody, toStream) struct fcd { zval *fcz; - zend_fcall_info *fci; - zend_fcall_info_cache *fcc; + zend_fcall_info fci; + zend_fcall_info_cache fcc; #ifdef ZTS void ***ts; #endif @@ -569,9 +569,9 @@ static size_t pass(void *cb_arg, const char *str, size_t len) MAKE_STD_ZVAL(zdata); ZVAL_STRINGL(zdata, str, len, 1); - if (SUCCESS == zend_fcall_info_argn(fcd->fci TSRMLS_CC, 2, fcd->fcz, zdata)) { - zend_fcall_info_call(fcd->fci, fcd->fcc, NULL, NULL TSRMLS_CC); - zend_fcall_info_args_clear(fcd->fci, 0); + if (SUCCESS == zend_fcall_info_argn(&fcd->fci TSRMLS_CC, 2, &fcd->fcz, &zdata)) { + zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL TSRMLS_CC); + zend_fcall_info_args_clear(&fcd->fci, 0); } zval_ptr_dtor(&zdata); return len; @@ -579,14 +579,19 @@ static size_t pass(void *cb_arg, const char *str, size_t len) PHP_METHOD(HttpMessageBody, toCallback) { - struct fcd fcd; + struct fcd fcd = {0}; long offset = 0, forlen = 0; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f|ll", &fcd.fci, &fcd.fcc, &offset, &forlen)) { php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); + fcd.fcz = getThis(); Z_ADDREF_P(fcd.fcz); + TSRMLS_SET_CTX(fcd.ts); + php_http_message_body_to_callback(obj->body, pass, &fcd, offset, forlen); + zend_fcall_info_args_clear(&fcd.fci, 1); + zval_ptr_dtor(&fcd.fcz); RETURN_TRUE; }