6 params: $transport $method_name $ttype $request_struct $seqID $strict_write
| 1019 | |
| 1020 | // 6 params: $transport $method_name $ttype $request_struct $seqID $strict_write |
| 1021 | PHP_FUNCTION(thrift_protocol_write_binary) { |
| 1022 | zval *protocol; |
| 1023 | zval *request_struct; |
| 1024 | zend_string *method_name; |
| 1025 | long msgtype, seqID; |
| 1026 | zend_bool strict_write; |
| 1027 | |
| 1028 | if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "oSlolb", |
| 1029 | &protocol, &method_name, &msgtype, |
| 1030 | &request_struct, &seqID, &strict_write) == FAILURE) { |
| 1031 | return; |
| 1032 | } |
| 1033 | |
| 1034 | try { |
| 1035 | zval* spec = zend_read_static_property(Z_OBJCE_P(request_struct), "_TSPEC", sizeof("_TSPEC")-1, true); |
| 1036 | if (spec) { |
| 1037 | ZVAL_DEREF(spec); |
| 1038 | } |
| 1039 | |
| 1040 | if (!spec || Z_TYPE_P(spec) != IS_ARRAY) { |
| 1041 | throw_tprotocolexception("Attempt serialize from non-Thrift object", INVALID_DATA); |
| 1042 | } |
| 1043 | |
| 1044 | PHPOutputTransport transport(protocol); |
| 1045 | protocol_writeMessageBegin(protocol, method_name, (int32_t) msgtype, (int32_t) seqID); |
| 1046 | binary_serialize_spec(request_struct, transport, Z_ARRVAL_P(spec)); |
| 1047 | transport.flush(); |
| 1048 | |
| 1049 | } catch (const PHPExceptionWrapper& ex) { |
| 1050 | // ex will be destructed, so copy to a zval that zend_throw_exception_object can take ownership of |
| 1051 | zval myex; |
| 1052 | ZVAL_COPY(&myex, ex); |
| 1053 | zend_throw_exception_object(&myex); |
| 1054 | RETURN_NULL(); |
| 1055 | } catch (const std::exception& ex) { |
| 1056 | throw_zend_exception_from_std_exception(ex); |
| 1057 | RETURN_NULL(); |
| 1058 | } |
| 1059 | } |
| 1060 | |
| 1061 | |
| 1062 | // 4 params: $transport $response_Typename $strict_read $buffer_size |
nothing calls this directly
no test coverage detected