Thrift now works in PHP, hot stuff
Summary: End to end communication working in Thrift with PHP
Problem: It's a bit slower than pillar still. Need to find out why.
Reviewed By: aditya
Test Plan: Unit tests are in the test directory. Get lucas on the PHP case...
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664720 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.cc b/lib/cpp/src/protocol/TBinaryProtocol.cc
index 666a6a4..6ac028a 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.cc
+++ b/lib/cpp/src/protocol/TBinaryProtocol.cc
@@ -240,8 +240,12 @@
uint32_t result;
int32_t size;
result = readI32(in, size);
- uint8_t b[size];
+
+ // Use the heap here to prevent stack overflow for v. large strings
+ uint8_t *b = new uint8_t[size];
in->readAll(b, size);
str = string((char*)b, size);
+ delete [] b;
+
return result + (uint32_t)size;
}