Tested with GCC 4.4, 4.8, 7.1 and 8.0
See https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|S!S!", &driver_name, &persistent_handle_name), invalid_arg, return);
if (!zend_hash_num_elements(&php_http_client_drivers)) {
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|S!S!", &driver_name, &persistent_handle_name), invalid_arg, return);
if (!zend_hash_num_elements(&php_http_client_drivers)) {
- php_http_throw(unexpected_val, "No http\\Client drivers available", NULL);
+ php_http_throw(unexpected_val, "No http\\Client drivers available");
return;
}
if (!(driver = php_http_client_driver_get(driver_name))) {
return;
}
if (!(driver = php_http_client_driver_get(driver_name))) {
msg_obj = PHP_HTTP_OBJ(NULL, request);
if (php_http_client_enqueued(obj->client, msg_obj->message, NULL)) {
msg_obj = PHP_HTTP_OBJ(NULL, request);
if (php_http_client_enqueued(obj->client, msg_obj->message, NULL)) {
- php_http_throw(bad_method_call, "Failed to enqueue request; request already in queue", NULL);
+ php_http_throw(bad_method_call, "Failed to enqueue request; request already in queue");
msg_obj = PHP_HTTP_OBJ(NULL, request);
if (!php_http_client_enqueued(obj->client, msg_obj->message, NULL)) {
msg_obj = PHP_HTTP_OBJ(NULL, request);
if (!php_http_client_enqueued(obj->client, msg_obj->message, NULL)) {
- php_http_throw(bad_method_call, "Failed to dequeue request; request not in queue", NULL);
+ php_http_throw(bad_method_call, "Failed to dequeue request; request not in queue");
}
/* not found for the request! */
}
/* not found for the request! */
- php_http_throw(unexpected_val, "Could not find response for the request", NULL);
+ php_http_throw(unexpected_val, "Could not find response for the request");
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
- php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
+ php_http_throw(unexpected_val, "Observer storage is corrupted");
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
- php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
+ php_http_throw(unexpected_val, "Observer storage is corrupted");
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
- php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
+ php_http_throw(unexpected_val, "Observer storage is corrupted");
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
if (Z_TYPE_P(observers) != IS_OBJECT) {
- php_http_throw(unexpected_val, "Observer storage is corrupted", NULL);
+ php_http_throw(unexpected_val, "Observer storage is corrupted");
/* request completed? */
if (Z_TYPE_P(info) != IS_OBJECT) {
/* request completed? */
if (Z_TYPE_P(info) != IS_OBJECT) {
- php_http_throw(bad_method_call, "Incomplete state", NULL);
+ php_http_throw(bad_method_call, "Incomplete state");
obj = PHP_HTTP_OBJ(NULL, getThis());
if (UNEXPECTED(obj->stream)) {
obj = PHP_HTTP_OBJ(NULL, getThis());
if (UNEXPECTED(obj->stream)) {
- php_http_throw(bad_method_call, "http\\Encoding\\Stream cannot be initialized twice", NULL);
+ php_http_throw(bad_method_call, "http\\Encoding\\Stream cannot be initialized twice");
/* short hand for zend_throw_exception_ex */
#define php_http_throw(e, fmt, ...) \
/* short hand for zend_throw_exception_ex */
#define php_http_throw(e, fmt, ...) \
- zend_throw_exception_ex(php_http_get_exception_ ##e## _class_entry(), 0, fmt, __VA_ARGS__)
+ zend_throw_exception_ex(php_http_get_exception_ ##e## _class_entry(), 0, fmt, ##__VA_ARGS__)
/* wrap a call with replaced zend_error_handling */
#define php_http_expect(test, e, fail) \
/* wrap a call with replaced zend_error_handling */
#define php_http_expect(test, e, fail) \
case IS_RESOURCE:
php_stream_from_zval_no_verify(s, zbody);
if (!s) {
case IS_RESOURCE:
php_stream_from_zval_no_verify(s, zbody);
if (!s) {
- php_http_throw(unexpected_val, "The stream is not a valid resource", NULL);
+ php_http_throw(unexpected_val, "The stream is not a valid resource");
php_http_buffer_init_ex(&buf, 0x1000, PHP_HTTP_BUFFER_INIT_PREALLOC);
if (PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE == php_http_message_parser_parse_stream(&p, &buf, s, flags, &msg)) {
if (!EG(exception)) {
php_http_buffer_init_ex(&buf, 0x1000, PHP_HTTP_BUFFER_INIT_PREALLOC);
if (PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE == php_http_message_parser_parse_stream(&p, &buf, s, flags, &msg)) {
if (!EG(exception)) {
- php_http_throw(bad_message, "Could not parse message from stream", NULL);
+ php_http_throw(bad_message, "Could not parse message from stream");
}
}
php_http_buffer_dtor(&buf);
}
}
php_http_buffer_dtor(&buf);
}
if (!msg && !EG(exception)) {
}
if (!msg && !EG(exception)) {
- php_http_throw(bad_message, "Empty message received from stream", NULL);
+ php_http_throw(bad_message, "Empty message received from stream");
}
} else if (zmessage) {
zend_string *zs_msg = zval_get_string(zmessage);
}
} else if (zmessage) {
zend_string *zs_msg = zval_get_string(zmessage);
msg = php_http_message_parse(NULL, zs_msg->val, zs_msg->len, greedy);
if (!msg && !EG(exception)) {
msg = php_http_message_parse(NULL, zs_msg->val, zs_msg->len, greedy);
if (!msg && !EG(exception)) {
- php_http_throw(bad_message, "Could not parse message: %.*s", MIN(25, zs_msg->len), zs_msg->val);
+ php_http_throw(bad_message, "Could not parse message: %.*s", (int)MIN(25, zs_msg->len), zs_msg->val);
}
zend_string_release(zs_msg);
}
}
zend_string_release(zs_msg);
}
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_RESPONSE) {
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_RESPONSE) {
- php_http_throw(bad_method_call, "http\\Message is not of type response", NULL);
+ php_http_throw(bad_method_call, "http\\Message is not of type response");
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_RESPONSE) {
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_RESPONSE) {
- php_http_throw(bad_method_call, "http\\Message is not of type response", NULL);
+ php_http_throw(bad_method_call, "http\\Message is not of type response");
}
PTR_SET(obj->message->http.info.response.status, estrndup(status, status_len));
}
PTR_SET(obj->message->http.info.response.status, estrndup(status, status_len));
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_REQUEST) {
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_REQUEST) {
- php_http_throw(bad_method_call, "http\\Message is not of type request", NULL);
+ php_http_throw(bad_method_call, "http\\Message is not of type request");
return;
}
if (method_len < 1) {
return;
}
if (method_len < 1) {
- php_http_throw(invalid_arg, "Cannot set http\\Message's request method to an empty string", NULL);
+ php_http_throw(invalid_arg, "Cannot set http\\Message's request method to an empty string");
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_REQUEST) {
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->type != PHP_HTTP_REQUEST) {
- php_http_throw(bad_method_call, "http\\Message is not of type request", NULL);
+ php_http_throw(bad_method_call, "http\\Message is not of type request");
if (url && php_http_url_is_empty(url)) {
php_http_url_free(&url);
if (url && php_http_url_is_empty(url)) {
php_http_url_free(&url);
- php_http_throw(invalid_arg, "Cannot set http\\Message's request url to an empty string", NULL);
+ php_http_throw(invalid_arg, "Cannot set http\\Message's request url to an empty string");
} else if (url) {
PTR_SET(obj->message->http.info.request.url, url);
}
} else if (url) {
PTR_SET(obj->message->http.info.request.url, url);
}
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (!obj->message->parent) {
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (!obj->message->parent) {
- php_http_throw(unexpected_val, "http\\Message has not parent message", NULL);
+ php_http_throw(unexpected_val, "http\\Message has not parent message");
for (msg[0] = obj->message; msg[0]; msg[0] = msg[0]->parent) {
for (msg[1] = prepend_obj->message; msg[1]; msg[1] = msg[1]->parent) {
if (msg[0] == msg[1]) {
for (msg[0] = obj->message; msg[0]; msg[0] = msg[0]->parent) {
for (msg[1] = prepend_obj->message; msg[1]; msg[1] = msg[1]->parent) {
if (msg[0] == msg[1]) {
- php_http_throw(unexpected_val, "Cannot prepend a message located within the same message chain", NULL);
+ php_http_throw(unexpected_val, "Cannot prepend a message located within the same message chain");
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (!php_http_message_is_multipart(obj->message, &boundary)) {
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (!php_http_message_is_multipart(obj->message, &boundary)) {
- php_http_throw(bad_method_call, "http\\Message is not a multipart message", NULL);
+ php_http_throw(bad_method_call, "http\\Message is not a multipart message");
ZVAL_MAKE_REF(_GET);
zend_update_property(php_http_querystring_class_entry, return_value, ZEND_STRL("queryArray"), _GET);
} else {
ZVAL_MAKE_REF(_GET);
zend_update_property(php_http_querystring_class_entry, return_value, ZEND_STRL("queryArray"), _GET);
} else {
- php_http_throw(unexpected_val, "Could not acquire reference to superglobal GET array", NULL);
+ php_http_throw(unexpected_val, "Could not acquire reference to superglobal GET array");