Summary: Avoid segfaulting via calling zend_fetch_class_entry on something
that might not actually be an object; throw an exception instead.
Reviewed by: shire
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665581
13f79535-47bb-0310-9956-
ffa450edef68
return;
case T_STRUCT: {
TSRMLS_FETCH();
+ if (Z_TYPE_PP(value) != IS_OBJECT) {
+ throw_tprotocolexception("Attempt to send non-object type as a T_STRUCT", INVALID_DATA);
+ }
zval* spec = zend_read_static_property(zend_get_class_entry(*value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
binary_serialize_spec(*value, transport, Z_ARRVAL_P(spec));
} return;