diff --git a/transports/curl.c b/transports/curl.c index 2abf365..6f9c3d3 100644 --- a/transports/curl.c +++ b/transports/curl.c @@ -418,7 +418,6 @@ yar_response_t * php_yar_curl_exec(yar_transport_interface_t* self, yar_request_ } /* }}} */ int php_yar_curl_send(yar_transport_interface_t* self, yar_request_t *request, char **msg TSRMLS_DC) /* {{{ */ { - CURL *cp; zval *payload; yar_header_t header = {0}; yar_curl_data_t *data = (yar_curl_data_t *)self->data; @@ -432,7 +431,6 @@ int php_yar_curl_send(yar_transport_interface_t* self, yar_request_t *request, c php_yar_protocol_render(&header, request->id, data->host->user, data->host->pass, Z_STRLEN_P(payload), 0 TSRMLS_CC); - cp = data->cp; smart_str_appendl(&data->postfield, (char *)&header, sizeof(yar_header_t)); smart_str_appendl(&data->postfield, Z_STRVAL_P(payload), Z_STRLEN_P(payload)); zval_ptr_dtor(&payload); @@ -723,7 +721,7 @@ int php_yar_curl_multi_exec(yar_transport_multi_interface_t *self, yar_concurren goto onerror; } else { /* timeout */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "select timeout '%d' seconds reached", YAR_G(timeout)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "select timeout '%ld' seconds reached", YAR_G(timeout)); goto onerror; } #endif diff --git a/transports/socket.c b/transports/socket.c index 627d351..2d1c9f8 100644 --- a/transports/socket.c +++ b/transports/socket.c @@ -210,7 +210,7 @@ int php_yar_socket_send(yar_transport_interface_t* self, yar_request_t *request, fd_set rfds; zval *payload; struct timeval tv; - int ret, fd, retval; + int ret = -1, fd, retval; char buf[SEND_BUF_SIZE]; yar_header_t header = {0}; yar_socket_data_t *data = (yar_socket_data_t *)self->data; @@ -242,11 +242,11 @@ int php_yar_socket_send(yar_transport_interface_t* self, yar_request_t *request, if (retval == -1) { zval_ptr_dtor(&payload); - spprintf(msg, 0, "select error '%s'", fd, strerror(errno)); + spprintf(msg, 0, "select error '%s'", strerror(errno)); return 0; } else if (retval == 0) { zval_ptr_dtor(&payload); - spprintf(msg, 0, "select timeout '%d' seconds reached", YAR_G(timeout)); + spprintf(msg, 0, "select timeout '%ld' seconds reached", YAR_G(timeout)); return 0; } @@ -277,11 +277,11 @@ int php_yar_socket_send(yar_transport_interface_t* self, yar_request_t *request, if (retval == -1) { zval_ptr_dtor(&payload); - spprintf(msg, 0, "select error '%s'", fd, strerror(errno)); + spprintf(msg, 0, "select error '%s'", strerror(errno)); return 0; } else if (retval == 0) { zval_ptr_dtor(&payload); - spprintf(msg, 0, "select timeout '%d' seconds reached", YAR_G(timeout)); + spprintf(msg, 0, "select timeout '%ld' seconds reached", YAR_G(timeout)); return 0; } diff --git a/yar_client.c b/yar_client.c index 94ba323..9c33a2a 100644 --- a/yar_client.c +++ b/yar_client.c @@ -228,6 +228,8 @@ static zval * php_yar_client_handle(int protocol, zval *client, char *method, lo factory = php_yar_transport_get(ZEND_STRL("curl") TSRMLS_CC); } else if (protocol == YAR_CLIENT_PROTOCOL_TCP || protocol == YAR_CLIENT_PROTOCOL_UNIX) { factory = php_yar_transport_get(ZEND_STRL("sock") TSRMLS_CC); + } else { + return NULL; } transport = factory->init(TSRMLS_C); diff --git a/yar_server.c b/yar_server.c index 8f633d9..54b0cde 100644 --- a/yar_server.c +++ b/yar_server.c @@ -310,11 +310,10 @@ static int php_yar_print_info(void *ptr, void *argument TSRMLS_DC) /* {{{ */ { char *prototype = NULL; if ((prototype = php_yar_get_function_declaration(f TSRMLS_CC))) { char *buf, *doc_comment = NULL; - uint buf_len; if (f->type == ZEND_USER_FUNCTION) { doc_comment = (char *)f->op_array.doc_comment; } - buf_len = spprintf(&buf, 0, HTML_MARKUP_ENTRY, prototype, doc_comment? doc_comment : ""); + spprintf(&buf, 0, HTML_MARKUP_ENTRY, prototype, doc_comment? doc_comment : ""); efree(prototype); PHPWRITE(buf, strlen(buf)); efree(buf);