Author: dreiss
Date: Thu Aug 12 23:27:54 2010
New Revision: 985038
URL: http://svn.apache.org/viewvc?rev=985038&view=rev
Log:
THRIFT-837. php: Fix accelerator bug affecting writes > 8k
Modified:
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
Modified:
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp?rev=985038&r1=985037&r2=985038&view=diff
==============================================================================
---
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
(original)
+++
incubator/thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
Thu Aug 12 23:27:54 2010
@@ -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);