From cf8fc15fa083d4111886b304e287e9811fe1b9c0 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Thu, 12 Aug 2010 23:27:54 +0000 Subject: [PATCH] THRIFT-837. php: Fix accelerator bug affecting writes > 8k git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@985038 13f79535-47bb-0310-9956-ffa450edef68 --- lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp index 2d2dc325..641fff2e 100644 --- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp +++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp @@ -218,12 +218,12 @@ protected: void directWrite(const char* data, size_t len) { zval writefn; ZVAL_STRING(&writefn, "write", 0); - char* newbuf = (char*)emalloc(buffer_used + 1); - memcpy(newbuf, buffer, buffer_used); - newbuf[buffer_used] = '\0'; + char* newbuf = (char*)emalloc(len + 1); + memcpy(newbuf, data, len); + newbuf[len] = '\0'; zval *args[1]; MAKE_STD_ZVAL(args[0]); - ZVAL_STRINGL(args[0], newbuf, buffer_used, 0); + ZVAL_STRINGL(args[0], newbuf, len, 0); TSRMLS_FETCH(); zval ret; ZVAL_NULL(&ret); -- 2.17.1