[thrift] return empty string instead of NULL
authordweatherford <dev-null@apache.org>
Fri, 2 Nov 2007 02:22:25 +0000 (02:22 +0000)
committerdweatherford <dev-null@apache.org>
Fri, 2 Nov 2007 02:22:25 +0000 (02:22 +0000)
Summary: Turns out they're different, oops
Reviewed By: marcel
Test Plan: recompile, reinstall, synapse:tablet.get() on a nonexistent cell (which returns an empty string)
Revert: ok

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665318 13f79535-47bb-0310-9956-ffa450edef68

lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp

index 38af4ab..1df54d5 100644 (file)
@@ -232,10 +232,10 @@ void binary_deserialize(long thrift_typeID, PHPTransport& transport, zval* retur
       uint32_t size;
       transport.readBytes(&size, 4);
       size = ntohl(size);
-      if (! size) { RETURN_NULL(); }
       char* strbuf = (char*) emalloc(size + 1);
-      if (! strbuf) { RETURN_NULL(); }
-      transport.readBytes(strbuf, size);
+      if (size) {
+        transport.readBytes(strbuf, size);
+      }
       strbuf[size] = '\0';
       ZVAL_STRINGL(return_value, strbuf, size, 0);
       return;