From 5436f0cc69b3bf7e056f0197e6aef43b188a0101 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 4 Feb 2019 15:37:15 +0100 Subject: - test build for https://github.com/m6w6/ext-http/pull/85 - ignore failed test with recent libcurl reported as https://github.com/m6w6/ext-http/issues/84 --- 85.patch | 262 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-http.spec | 22 ++++- 2 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 85.patch diff --git a/85.patch b/85.patch new file mode 100644 index 0000000..87b4a26 --- /dev/null +++ b/85.patch @@ -0,0 +1,262 @@ +From 597b66905b295d3a7ed408a92751a5f29e19fe01 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 4 Feb 2019 15:23:37 +0100 +Subject: [PATCH] Fix [-Wformat-extra-args] build warnings + +Tested with GCC 4.4, 4.8, 7.1 and 8.0 +See https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html +--- + src/php_http_client.c | 16 ++++++++-------- + src/php_http_client_response.c | 2 +- + src/php_http_encoding.c | 2 +- + src/php_http_exception.h | 2 +- + src/php_http_message.c | 26 +++++++++++++------------- + src/php_http_querystring.c | 2 +- + 6 files changed, 25 insertions(+), 25 deletions(-) + +diff --git a/src/php_http_client.c b/src/php_http_client.c +index 2f8b4ae..317b494 100644 +--- a/src/php_http_client.c ++++ b/src/php_http_client.c +@@ -583,7 +583,7 @@ static PHP_METHOD(HttpClient, __construct) + 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))) { +@@ -697,7 +697,7 @@ static PHP_METHOD(HttpClient, enqueue) + 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"); + return; + } + +@@ -749,7 +749,7 @@ static PHP_METHOD(HttpClient, dequeue) + 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"); + return; + } + +@@ -843,7 +843,7 @@ static PHP_METHOD(HttpClient, getResponse) + } + + /* 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"); + return; + } + +@@ -999,7 +999,7 @@ static PHP_METHOD(HttpClient, notify) + 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"); + return; + } + +@@ -1045,7 +1045,7 @@ static PHP_METHOD(HttpClient, attach) + 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"); + return; + } + +@@ -1072,7 +1072,7 @@ static PHP_METHOD(HttpClient, detach) + 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"); + return; + } + +@@ -1094,7 +1094,7 @@ static PHP_METHOD(HttpClient, getObservers) + 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"); + return; + } + +diff --git a/src/php_http_client_response.c b/src/php_http_client_response.c +index 5acddae..34748aa 100644 +--- a/src/php_http_client_response.c ++++ b/src/php_http_client_response.c +@@ -105,7 +105,7 @@ static PHP_METHOD(HttpClientResponse, getTransferInfo) + + /* 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"); + return; + } + +diff --git a/src/php_http_encoding.c b/src/php_http_encoding.c +index c3e9a3a..4e25de3 100644 +--- a/src/php_http_encoding.c ++++ b/src/php_http_encoding.c +@@ -528,7 +528,7 @@ static PHP_METHOD(HttpEncodingStream, __construct) + 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"); + return; + } + +diff --git a/src/php_http_exception.h b/src/php_http_exception.h +index e3e66f1..7638e67 100644 +--- a/src/php_http_exception.h ++++ b/src/php_http_exception.h +@@ -15,7 +15,7 @@ + + /* 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) \ +diff --git a/src/php_http_message.c b/src/php_http_message.c +index d70ced4..aa09736 100644 +--- a/src/php_http_message.c ++++ b/src/php_http_message.c +@@ -776,7 +776,7 @@ ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg + 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"); + return FAILURE; + } + +@@ -1076,7 +1076,7 @@ static PHP_METHOD(HttpMessage, __construct) + 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); +@@ -1084,7 +1084,7 @@ static PHP_METHOD(HttpMessage, __construct) + } + + 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); +@@ -1092,7 +1092,7 @@ static PHP_METHOD(HttpMessage, __construct) + 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); + } +@@ -1492,7 +1492,7 @@ static PHP_METHOD(HttpMessage, setResponseCode) + 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"); + return; + } + +@@ -1544,7 +1544,7 @@ static PHP_METHOD(HttpMessage, setResponseStatus) + 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)); +@@ -1589,12 +1589,12 @@ static PHP_METHOD(HttpMessage, setRequestMethod) + 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) { +- 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"); + return; + } + +@@ -1645,7 +1645,7 @@ static PHP_METHOD(HttpMessage, setRequestUrl) + 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; + } + +@@ -1655,7 +1655,7 @@ static PHP_METHOD(HttpMessage, setRequestUrl) + + 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); + } +@@ -1675,7 +1675,7 @@ static PHP_METHOD(HttpMessage, getParentMessage) + 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"); + return; + } + +@@ -1832,7 +1832,7 @@ static PHP_METHOD(HttpMessage, prepend) + 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"); + return; + } + } +@@ -1892,7 +1892,7 @@ static PHP_METHOD(HttpMessage, splitMultipartBody) + 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"); + return; + } + +diff --git a/src/php_http_querystring.c b/src/php_http_querystring.c +index a302bbd..566d434 100644 +--- a/src/php_http_querystring.c ++++ b/src/php_http_querystring.c +@@ -386,7 +386,7 @@ PHP_METHOD(HttpQueryString, getGlobalInstance) + 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"); + } + + } diff --git a/php-pecl-http.spec b/php-pecl-http.spec index d579b72..d98818c 100644 --- a/php-pecl-http.spec +++ b/php-pecl-http.spec @@ -3,7 +3,7 @@ # # Fedora spec file for php-pecl-http # -# Copyright (c) 2012-2018 Remi Collet +# Copyright (c) 2012-2019 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -50,7 +50,7 @@ Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Release: 0.5.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz %else -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: http://pecl.php.net/get/%{proj_name}-%{upstream_version}%{?upstream_prever}.tgz %endif Summary: Extended HTTP support @@ -61,6 +61,8 @@ URL: http://pecl.php.net/package/pecl_http # From http://www.php.net/manual/en/http.configuration.php Source1: %{proj_name}.ini +Patch0: https://patch-diff.githubusercontent.com/raw/m6w6/ext-http/pull/85.patch + BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7 BuildRequires: %{?scl_prefix}php-hash @@ -176,6 +178,8 @@ mv %{proj_name}-%{upstream_version}%{?upstream_prever} NTS %{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} cd NTS +%patch0 -p1 -b .pr85 + extver=$(sed -n '/#define PHP_PECL_HTTP_VERSION/{s/.* "//;s/".*$//;p}' php_http.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:dev}"; then : Error: Upstream HTTP version is now ${extver}, expecting %{upstream_version}%{?upstream_prever}%{?gh_date:dev}. @@ -194,6 +198,7 @@ cp -pr NTS ZTS %build %{?dtsenable} +gcc --version peclconf() { %configure \ @@ -283,7 +288,15 @@ done --modules | grep %{pecl_name} %if %{with_tests} +: ignore tests with erratic results rm ?TS/tests/client022.phpt +rm ?TS/tests/client027.phpt +%if 0%{?fedora} >= 30 +: https://github.com/m6w6/ext-http/issues/84 +rm ?TS/tests/client008.phpt +rm ?TS/tests/client018.phpt +rm ?TS/tests/client021.phpt +%endif : Upstream test suite NTS extension cd NTS @@ -354,6 +367,11 @@ fi %changelog +* Mon Feb 4 2019 Remi Collet - 3.2.0-3 +- test build for https://github.com/m6w6/ext-http/pull/85 +- ignore failed test with recent libcurl + reported as https://github.com/m6w6/ext-http/issues/84 + * Thu Aug 16 2018 Remi Collet - 3.2.0-2 - rebuild for 7.3.0beta2 new ABI -- cgit