diff --git a/tdlib.c b/tdlib.c index 06685b4..6fa2e40 100644 --- a/tdlib.c +++ b/tdlib.c @@ -3,6 +3,7 @@ #endif #include "php.h" +#include "zend_smart_str.h" #include "php_tdlib.h" #include "ext/json/php_json.h" #include "zend_exceptions.h" @@ -159,7 +160,7 @@ PHP_METHOD (TdLib, receive) { void *tdClient = tdlib_client_get_instance(getThis()); double timeout; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_DOUBLE(timeout); ZEND_PARSE_PARAMETERS_END(); @@ -190,6 +191,7 @@ PHP_METHOD (TdLib, send) { if (tdClient) { php_json_encode(&buf, parameter, 0); + smart_str_0(&buf); td_json_client_send(tdClient, ZSTR_VAL(buf.s)); } @@ -205,6 +207,7 @@ PHP_METHOD (TdLib, execute) { php_json_encode(&buf, parameter, 0); + smart_str_0(&buf); const char *response = td_json_client_execute(NULL, ZSTR_VAL(buf.s));