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
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 2d2dc32..641fff2 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 @@
   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);