From: dweatherford Date: Fri, 2 Nov 2007 02:22:25 +0000 (+0000) Subject: [thrift] return empty string instead of NULL X-Git-Tag: 0.2.0~1154 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=f36e484cfb8a919e8bc587bec91d14ef55e2eb1b;p=common%2Fthrift.git [thrift] return empty string instead of NULL 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 --- 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 38af4ab9..1df54d54 100644 --- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp +++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp @@ -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;