THRIFT-780. php: Prevent aborts due to simultaneous exceptions
authorBryan Duxbury <bryanduxbury@apache.org>
Thu, 12 Aug 2010 15:00:41 +0000 (15:00 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Thu, 12 Aug 2010 15:00:41 +0000 (15:00 +0000)
commit7c74d9bfb131ee4486a04c5405173234cfa06f28
tree5918312b8b47f194fef5ba057643f4edd1278734
parentb149bc7050c5136f3b071e1c1251f0f2716ae208
THRIFT-780. php: Prevent aborts due to simultaneous exceptions

The bug was triggered when flush() threw an exception in the
PHPOutputTransport destructor.

The PHPOutputTransport in thrift_protocol_write_binary() wasn't
constructed inside of the try block, so exceptions thrown when it was
auto-flushing in the destructor were calling terminate().

Move the transport construction inside of the try block, and add an
explicit flush before the transport is destroyed (since throwing an
exception from a destructor is generally a bad thing).

Patch: David Reiss

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@984815 13f79535-47bb-0310-9956-ffa450edef68
lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp