summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pecl_http-upstream.patch701
-rw-r--r--php-pecl-http.spec30
2 files changed, 718 insertions, 13 deletions
diff --git a/pecl_http-upstream.patch b/pecl_http-upstream.patch
new file mode 100644
index 0000000..e7a547f
--- /dev/null
+++ b/pecl_http-upstream.patch
@@ -0,0 +1,701 @@
+Create using git diff RELEASE_3_2_0 -- src >/tmp/pp
+
+
+diff --git a/src/php_http_api.h b/src/php_http_api.h
+index 91b2eb6..bca57f1 100644
+--- a/src/php_http_api.h
++++ b/src/php_http_api.h
+@@ -13,6 +13,14 @@
+ #ifndef PHP_HTTP_API_H
+ #define PHP_HTTP_API_H
+
++#ifdef __COVERITY_GCC_VERSION_AT_LEAST
++# define _Float128 float
++# define _Float64 float
++# define _Float32 float
++# define _Float64x float
++# define _Float32x float
++#endif
++
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+diff --git a/src/php_http_buffer.c b/src/php_http_buffer.c
+index c865065..5913cfc 100644
+--- a/src/php_http_buffer.c
++++ b/src/php_http_buffer.c
+@@ -10,7 +10,7 @@
+ +--------------------------------------------------------------------+
+ */
+
+-#include "php.h"
++#include "php_http_api.h"
+ #include "php_http_buffer.h"
+
+ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(
+diff --git a/src/php_http_client.c b/src/php_http_client.c
+index 0749825..ed38522 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;
+ }
+
+@@ -986,6 +986,7 @@ static int notify(zend_object_iterator *iter, void *puser)
+
+ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, request, http\\Client\\Request, 1)
++ ZEND_ARG_INFO(0, progress)
+ ZEND_END_ARG_INFO();
+ static PHP_METHOD(HttpClient, notify)
+ {
+@@ -999,7 +1000,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 +1046,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 +1073,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 +1095,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;
+ }
+
+@@ -1314,7 +1315,7 @@ static PHP_METHOD(HttpClient, setDebug)
+ }
+
+ static zend_function_entry php_http_client_methods[] = {
+- PHP_ME(HttpClient, __construct, ai_HttpClient_construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpClient, __construct, ai_HttpClient_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, reset, ai_HttpClient_reset, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, enqueue, ai_HttpClient_enqueue, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, dequeue, ai_HttpClient_dequeue, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c
+index b17d8a6..45515fa 100644
+--- a/src/php_http_client_curl.c
++++ b/src/php_http_client_curl.c
+@@ -516,7 +516,11 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
+ zval ti_array, subarray;
+ struct curl_tlssessioninfo *ti;
+
++#if PHP_HTTP_CURL_VERSION(7,48,0)
++ if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_TLS_SSL_PTR, &ti)) {
++#else
+ if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_TLS_SESSION, &ti)) {
++#endif
+ char *backend;
+
+ ZVAL_NULL(&subarray);
+@@ -530,15 +534,22 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
+ backend = "openssl";
+ #if PHP_HTTP_HAVE_LIBCURL_OPENSSL
+ {
++#if PHP_HTTP_CURL_VERSION(7,48,0)
++ SSL *ssl = ti->internals;
++ SSL_CTX *ctx = ssl ? SSL_get_SSL_CTX(ssl) : NULL;
++#else
+ SSL_CTX *ctx = ti->internals;
++#endif
+
+ array_init(&subarray);
+- add_assoc_long_ex(&subarray, ZEND_STRL("number"), SSL_CTX_sess_number(ctx));
+- add_assoc_long_ex(&subarray, ZEND_STRL("connect"), SSL_CTX_sess_connect(ctx));
+- add_assoc_long_ex(&subarray, ZEND_STRL("connect_good"), SSL_CTX_sess_connect_good(ctx));
+- add_assoc_long_ex(&subarray, ZEND_STRL("connect_renegotiate"), SSL_CTX_sess_connect_renegotiate(ctx));
+- add_assoc_long_ex(&subarray, ZEND_STRL("hits"), SSL_CTX_sess_hits(ctx));
+- add_assoc_long_ex(&subarray, ZEND_STRL("cache_full"), SSL_CTX_sess_cache_full(ctx));
++ if (ctx) {
++ add_assoc_long_ex(&subarray, ZEND_STRL("number"), SSL_CTX_sess_number(ctx));
++ add_assoc_long_ex(&subarray, ZEND_STRL("connect"), SSL_CTX_sess_connect(ctx));
++ add_assoc_long_ex(&subarray, ZEND_STRL("connect_good"), SSL_CTX_sess_connect_good(ctx));
++ add_assoc_long_ex(&subarray, ZEND_STRL("connect_renegotiate"), SSL_CTX_sess_connect_renegotiate(ctx));
++ add_assoc_long_ex(&subarray, ZEND_STRL("hits"), SSL_CTX_sess_hits(ctx));
++ add_assoc_long_ex(&subarray, ZEND_STRL("cache_full"), SSL_CTX_sess_cache_full(ctx));
++ }
+ }
+ #endif
+ break;
+@@ -550,11 +561,13 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
+ char *desc;
+
+ array_init(&subarray);
+- if ((desc = gnutls_session_get_desc(sess))) {
+- add_assoc_string_ex(&subarray, ZEND_STRL("desc"), desc);
+- gnutls_free(desc);
++ if (sess) {
++ if ((desc = gnutls_session_get_desc(sess))) {
++ add_assoc_string_ex(&subarray, ZEND_STRL("desc"), desc);
++ gnutls_free(desc);
++ }
++ add_assoc_bool_ex(&subarray, ZEND_STRL("resumed"), gnutls_session_is_resumed(sess));
+ }
+- add_assoc_bool_ex(&subarray, ZEND_STRL("resumed"), gnutls_session_is_resumed(sess));
+ }
+ #endif
+ break;
+@@ -2061,6 +2074,8 @@ static void php_http_client_curl_handler_clear(php_http_client_curl_handler_t *h
+ curl_easy_setopt(handler->handle, CURLOPT_DEBUGFUNCTION, NULL);
+ curl_easy_setopt(handler->handle, CURLOPT_COOKIELIST, "FLUSH");
+ curl_easy_setopt(handler->handle, CURLOPT_SHARE, NULL);
++ /* see gh issue #84 */
++ curl_easy_setopt(handler->handle, CURLOPT_COOKIEJAR, NULL);
+ }
+
+ static void php_http_client_curl_handler_dtor(php_http_client_curl_handler_t *handler)
+diff --git a/src/php_http_client_curl.h b/src/php_http_client_curl.h
+index 21b6834..61723b9 100644
+--- a/src/php_http_client_curl.h
++++ b/src/php_http_client_curl.h
+@@ -43,13 +43,27 @@ typedef struct php_http_client_curl {
+
+ static inline void php_http_client_curl_get_timeout(php_http_client_curl_t *curl, long max_tout, struct timeval *timeout)
+ {
+- if ((CURLM_OK == curl_multi_timeout(curl->handle->multi, &max_tout)) && (max_tout > 0)) {
+- timeout->tv_sec = max_tout / 1000;
+- timeout->tv_usec = (max_tout % 1000) * 1000;
+- } else {
+- timeout->tv_sec = 0;
+- timeout->tv_usec = 1000;
++ timeout->tv_sec = 0;
++ timeout->tv_usec = 0;
++
++ /* always returns CURLM_OK, check max_tout instead */
++ curl_multi_timeout(curl->handle->multi, &max_tout);
++
++ if (!max_tout) {
++ /* immediately */
++ return;
+ }
++
++ if (max_tout < 0) {
++ /* 5ms */
++ max_tout = 5;
++ } else if (max_tout > 1000) {
++ /* 1s */
++ max_tout = 1000;
++ }
++
++ timeout->tv_sec = max_tout / 1000;
++ timeout->tv_usec = (max_tout % 1000) * 1000;
+ }
+
+ PHP_HTTP_API void php_http_client_curl_responsehandler(php_http_client_t *client);
+diff --git a/src/php_http_client_request.c b/src/php_http_client_request.c
+index 71a9129..9055f49 100644
+--- a/src/php_http_client_request.c
++++ b/src/php_http_client_request.c
+@@ -273,7 +273,7 @@ static PHP_METHOD(HttpClientRequest, getSslOptions)
+ }
+
+ static zend_function_entry php_http_client_request_methods[] = {
+- PHP_ME(HttpClientRequest, __construct, ai_HttpClientRequest___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpClientRequest, __construct, ai_HttpClientRequest___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, setContentType, ai_HttpClientRequest_setContentType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, getContentType, ai_HttpClientRequest_getContentType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, setQuery, ai_HttpClientRequest_setQuery, ZEND_ACC_PUBLIC)
+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 c20e163..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;
+ }
+
+@@ -640,7 +640,7 @@ static PHP_METHOD(HttpEncodingStream, finish)
+ }
+
+ static zend_function_entry php_http_encoding_stream_methods[] = {
+- PHP_ME(HttpEncodingStream, __construct, ai_HttpEncodingStream___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpEncodingStream, __construct, ai_HttpEncodingStream___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEncodingStream, update, ai_HttpEncodingStream_update, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEncodingStream, flush, ai_HttpEncodingStream_flush, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEncodingStream, done, ai_HttpEncodingStream_done, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_env.c b/src/php_http_env.c
+index 21bd89a..4afcd31 100644
+--- a/src/php_http_env.c
++++ b/src/php_http_env.c
+@@ -501,7 +501,7 @@ ZEND_RESULT_CODE php_http_env_set_response_header_value(long http_code, const ch
+ return FAILURE;
+ }
+ h.response_code = http_code;
+- h.line_len = spprintf(&h.line, 0, "%.*s: %.*s", (int) name_len, name_str, data->len, data->val);
++ h.line_len = spprintf(&h.line, 0, "%s: %s", name_str, data->val);
+
+ ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h);
+
+diff --git a/src/php_http_env_request.c b/src/php_http_env_request.c
+index b5454ed..7c6eea8 100644
+--- a/src/php_http_env_request.c
++++ b/src/php_http_env_request.c
+@@ -245,7 +245,7 @@ static PHP_METHOD(HttpEnvRequest, getFiles)
+ }
+
+ static zend_function_entry php_http_env_request_methods[] = {
+- PHP_ME(HttpEnvRequest, __construct, ai_HttpEnvRequest___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpEnvRequest, __construct, ai_HttpEnvRequest___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvRequest, getForm, ai_HttpEnvRequest_getForm, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvRequest, getQuery, ai_HttpEnvRequest_getQuery, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvRequest, getCookie, ai_HttpEnvRequest_getCookie, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_env_response.c b/src/php_http_env_response.c
+index 40ef4fe..f5d2da9 100644
+--- a/src/php_http_env_response.c
++++ b/src/php_http_env_response.c
+@@ -1393,7 +1393,7 @@ static PHP_METHOD(HttpEnvResponse, send)
+ }
+
+ static zend_function_entry php_http_env_response_methods[] = {
+- PHP_ME(HttpEnvResponse, __construct, ai_HttpEnvResponse___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpEnvResponse, __construct, ai_HttpEnvResponse___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, __invoke, ai_HttpEnvResponse___invoke, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setEnvRequest, ai_HttpEnvResponse_setEnvRequest, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setCookie, ai_HttpEnvResponse_setCookie, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_exception.h b/src/php_http_exception.h
+index e3e66f1..a7a0f7e 100644
+--- a/src/php_http_exception.h
++++ b/src/php_http_exception.h
+@@ -14,8 +14,8 @@
+ #define PHP_HTTP_EXCEPTION_H
+
+ /* 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__)
++#define php_http_throw(e, ...) \
++ zend_throw_exception_ex(php_http_get_exception_ ##e## _class_entry(), 0, __VA_ARGS__)
+
+ /* wrap a call with replaced zend_error_handling */
+ #define php_http_expect(test, e, fail) \
+diff --git a/src/php_http_header.c b/src/php_http_header.c
+index 8c71cde..4c9a702 100644
+--- a/src/php_http_header.c
++++ b/src/php_http_header.c
+@@ -398,7 +398,7 @@ PHP_METHOD(HttpHeader, parse)
+ }
+
+ static zend_function_entry php_http_header_methods[] = {
+- PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_message.c b/src/php_http_message.c
+index 49aa0f9..55fdb81 100644
+--- a/src/php_http_message.c
++++ b/src/php_http_message.c
+@@ -510,7 +510,8 @@ zend_class_entry *php_http_message_get_class_entry(void)
+ }
+
+ static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv);
+-static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
++
++static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
+
+ static zend_object_handlers php_http_message_object_handlers;
+ static HashTable php_http_message_object_prophandlers;
+@@ -776,7 +777,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;
+ }
+
+@@ -894,6 +895,13 @@ void php_http_message_object_free(zend_object *object)
+ zend_object_std_dtor(object);
+ }
+
++#if PHP_VERSION_ID >= 70400
++static zval *php_http_message_object_get_prop_ptr(zval *object, zval *member, int type, void **cache_slot)
++{
++ return NULL;
++}
++#endif
++
+ static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp)
+ {
+ zval *return_value;
+@@ -923,7 +931,7 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t
+ return return_value;
+ }
+
+-static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot)
++static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot)
+ {
+ php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
+ php_http_message_object_prophandler_t *handler;
+@@ -938,6 +946,7 @@ static void php_http_message_object_write_prop(zval *object, zval *member, zval
+ }
+
+ zend_string_release(member_name);
++ PHP_WRITE_PROP_HANDLER_RETURN(value);
+ }
+
+ static HashTable *php_http_message_object_get_debug_info(zval *object, int *is_temp)
+@@ -1076,7 +1085,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 +1093,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 +1101,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 +1501,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 +1553,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 +1598,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 +1654,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 +1664,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 +1684,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 no parent message");
+ return;
+ }
+
+@@ -1832,7 +1841,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 +1901,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;
+ }
+
+@@ -1993,7 +2002,7 @@ static PHP_METHOD(HttpMessage, current)
+ }
+
+ static zend_function_entry php_http_message_methods[] = {
+- PHP_ME(HttpMessage, __construct, ai_HttpMessage___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpMessage, __construct, ai_HttpMessage___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getBody, ai_HttpMessage_getBody, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setBody, ai_HttpMessage_setBody, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, addBody, ai_HttpMessage_addBody, ZEND_ACC_PUBLIC)
+@@ -2062,7 +2071,11 @@ PHP_MINIT_FUNCTION(http_message)
+ php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
+ php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
+ php_http_message_object_handlers.get_debug_info = php_http_message_object_get_debug_info;
++#if PHP_VERSION_ID >= 70400
++ php_http_message_object_handlers.get_property_ptr_ptr = php_http_message_object_get_prop_ptr;
++#else
+ php_http_message_object_handlers.get_property_ptr_ptr = NULL;
++#endif
+ php_http_message_object_handlers.get_gc = php_http_message_object_get_gc;
+
+ zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
+diff --git a/src/php_http_message_body.c b/src/php_http_message_body.c
+index 518dbc9..79c8bf7 100644
+--- a/src/php_http_message_body.c
++++ b/src/php_http_message_body.c
+@@ -907,7 +907,7 @@ PHP_METHOD(HttpMessageBody, stat)
+ }
+
+ static zend_function_entry php_http_message_body_methods[] = {
+- PHP_ME(HttpMessageBody, __construct, ai_HttpMessageBody___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpMessageBody, __construct, ai_HttpMessageBody___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, toString, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, serialize, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_misc.h b/src/php_http_misc.h
+index 35de35e..b91638e 100644
+--- a/src/php_http_misc.h
++++ b/src/php_http_misc.h
+@@ -99,7 +99,11 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i
+
+ #if PHP_DEBUG
+ # undef HASH_OF
+-# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL))))
++# if PHP_VERSION_ID >= 70500
++# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL))))
++# else
++# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL))))
++# endif
+ #endif
+
+ #ifndef GC_SET_REFCOUNT
+@@ -128,6 +132,14 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i
+ # define HT_UNPROTECT_RECURSION(ht) GC_UNPROTECT_RECURSION(ht)
+ #endif
+
++#if PHP_VERSION_ID >= 70400
++# define PHP_WRITE_PROP_HANDLER_TYPE zval *
++# define PHP_WRITE_PROP_HANDLER_RETURN(v) return v
++#else
++# define PHP_WRITE_PROP_HANDLER_TYPE void
++# define PHP_WRITE_PROP_HANDLER_RETURN(v)
++#endif
++
+ static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv)
+ {
+ if (!zo) {
+diff --git a/src/php_http_params.c b/src/php_http_params.c
+index 0cbfc7e..92c1441 100644
+--- a/src/php_http_params.c
++++ b/src/php_http_params.c
+@@ -1290,7 +1290,7 @@ PHP_METHOD(HttpParams, offsetSet)
+ }
+
+ static zend_function_entry php_http_params_methods[] = {
+- PHP_ME(HttpParams, __construct, ai_HttpParams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL)
++ PHP_ME(HttpParams, __construct, ai_HttpParams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+
+ PHP_ME(HttpParams, toArray, ai_HttpParams_toArray, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpParams, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_querystring.c b/src/php_http_querystring.c
+index 96b58a7..bd3afe5 100644
+--- a/src/php_http_querystring.c
++++ b/src/php_http_querystring.c
+@@ -103,7 +103,7 @@ ZEND_RESULT_CODE php_http_querystring_xlate(zval *dst, zval *src, const char *ie
+ {
+ if (key.key) {
+ if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(key.key->val, key.key->len, &xkey, oe, ie)) {
+- php_error_docref(NULL, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", key.key->len, key.key->val, ie, oe);
++ php_error_docref(NULL, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", (int) key.key->len, key.key->val, ie, oe);
+ return FAILURE;
+ }
+ }
+@@ -113,7 +113,7 @@ ZEND_RESULT_CODE php_http_querystring_xlate(zval *dst, zval *src, const char *ie
+ if (key.key) {
+ zend_string_release(xkey);
+ }
+- php_error_docref(NULL, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", Z_STRLEN_P(entry), Z_STRVAL_P(entry), ie, oe);
++ php_error_docref(NULL, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", (int) Z_STRLEN_P(entry), Z_STRVAL_P(entry), ie, oe);
+ return FAILURE;
+ }
+ if (key.key) {
+@@ -370,23 +370,28 @@ ZEND_END_ARG_INFO();
+ PHP_METHOD(HttpQueryString, getGlobalInstance)
+ {
+ zval *instance, *_GET;
+- zend_string *zs;
+
+ php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
+
+- zs = zend_string_init(ZEND_STRL("instance"), 0);
+- instance = zend_std_get_static_property(php_http_querystring_class_entry, zs, 0);
+- zend_string_release(zs);
++ instance = zend_read_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), 0);
+
+ if (Z_TYPE_P(instance) == IS_OBJECT) {
+ RETVAL_ZVAL(instance, 1, 0);
+ } else if ((_GET = php_http_env_get_superglobal(ZEND_STRL("_GET")))) {
++ zval tmp, *qa;
++
+ ZVAL_OBJ(return_value, php_http_querystring_object_new(php_http_querystring_class_entry));
+
+- ZVAL_MAKE_REF(_GET);
+- zend_update_property(php_http_querystring_class_entry, return_value, ZEND_STRL("queryArray"), _GET);
++ ZVAL_STRING(&tmp, "queryArray");
++ qa = Z_OBJ_HT_P(return_value)->get_property_ptr_ptr(return_value, &tmp, BP_VAR_RW, NULL);
++ zval_ptr_dtor(&tmp);
++
++ ZVAL_NEW_REF(_GET, _GET);
++ ZVAL_COPY(qa, _GET);
++
++ zend_update_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), return_value);
+ } 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");
+ }
+
+ }
+@@ -680,7 +685,7 @@ PHP_METHOD(HttpQueryString, offsetUnset)
+ }
+
+ static zend_function_entry php_http_querystring_methods[] = {
+- PHP_ME(HttpQueryString, __construct, ai_HttpQueryString___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL)
++ PHP_ME(HttpQueryString, __construct, ai_HttpQueryString___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+
+ PHP_ME(HttpQueryString, toArray, ai_HttpQueryString_toArray, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC)
+diff --git a/src/php_http_url.c b/src/php_http_url.c
+index 71ca6e9..24a13ff 100644
+--- a/src/php_http_url.c
++++ b/src/php_http_url.c
+@@ -2035,7 +2035,7 @@ PHP_METHOD(HttpUrl, toArray)
+ }
+
+ static zend_function_entry php_http_url_methods[] = {
+- PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpUrl, mod, ai_HttpUrl_mod, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpUrl, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
+@@ -2088,14 +2088,14 @@ PHP_MINIT_FUNCTION(http_url)
+ #endif
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOPCT"), PHP_HTTP_URL_PARSE_TOPCT);
+
+- INIT_NS_CLASS_ENTRY(ce, "http\\Env", "Url", php_http_url_methods);
+- php_http_env_url_class_entry = zend_register_internal_class_ex(&ce, php_http_url_class_entry);
+-
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("IGNORE_ERRORS"), PHP_HTTP_URL_IGNORE_ERRORS);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("SILENT_ERRORS"), PHP_HTTP_URL_SILENT_ERRORS);
+
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STDFLAGS"), PHP_HTTP_URL_STDFLAGS);
+
++ INIT_NS_CLASS_ENTRY(ce, "http\\Env", "Url", NULL);
++ php_http_env_url_class_entry = zend_register_internal_class_ex(&ce, php_http_url_class_entry);
++
+ return SUCCESS;
+ }
+
+diff --git a/src/php_http_url.h b/src/php_http_url.h
+index 6d4b09d..eead59a 100644
+--- a/src/php_http_url.h
++++ b/src/php_http_url.h
+@@ -62,7 +62,6 @@
+ #define PHP_HTTP_URL_STDFLAGS 0x00332003
+
+ typedef struct php_http_url {
+- /* compatible to php_url, but do not use php_url_free() */
+ char *scheme;
+ char *user;
+ char *pass;
diff --git a/php-pecl-http.spec b/php-pecl-http.spec
index dbdfb7c..7535e60 100644
--- a/php-pecl-http.spec
+++ b/php-pecl-http.spec
@@ -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: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 5%{?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
@@ -62,6 +62,7 @@ URL: http://pecl.php.net/package/pecl_http
Source1: %{proj_name}.ini
Patch0: https://patch-diff.githubusercontent.com/raw/m6w6/ext-http/pull/85.patch
+Patch1: %{proj_name}-upstream.patch
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7
@@ -104,16 +105,6 @@ Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
-Obsoletes: php53-pecl-http <= %{version}
-Obsoletes: php53u-pecl-http <= %{version}
-Obsoletes: php54-pecl-http <= %{version}
-Obsoletes: php54w-pecl-http <= %{version}
-Obsoletes: php55u-pecl-http <= %{version}
-Obsoletes: php55w-pecl-http <= %{version}
-Obsoletes: php56u-pecl-http <= %{version}
-Obsoletes: php56w-pecl-http <= %{version}
-Obsoletes: php70u-pecl-http <= %{version}
-Obsoletes: php70w-pecl-http <= %{version}
%if "%{php_version}" > "7.1"
Obsoletes: php71u-pecl-http <= %{version}
Obsoletes: php71w-pecl-http <= %{version}
@@ -123,9 +114,13 @@ Obsoletes: php72u-pecl-http <= %{version}
Obsoletes: php72w-pecl-http <= %{version}
%endif
%if "%{php_version}" > "7.3"
-Obsoletes: php73u-pecl-http <= %{version}
+Obsoletes: php73-pecl-http <= %{version}
Obsoletes: php73w-pecl-http <= %{version}
%endif
+%if "%{php_version}" > "7.4"
+Obsoletes: php74-pecl-http <= %{version}
+Obsoletes: php74w-pecl-http <= %{version}
+%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
@@ -178,7 +173,13 @@ mv %{proj_name}-%{upstream_version}%{?upstream_prever} NTS
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
cd NTS
+%if "%{php_version}" > "7.4"
+%patch1 -p1 -b .up
+rm tests/etag001.phpt
+rm tests/message015.phpt
+%else
%patch0 -p1 -b .pr85
+%endif
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
@@ -267,7 +268,7 @@ export REPORT_EXIT_STATUS=1
user=$(id -un)
: all tests when rpmbuild is used
if [ "$user" = "remi" ]; then
-export SKIP_ONLINE_TESTS=0
+export SKIP_ONLINE_TESTS=1
else
: only local tests when mock is used
export SKIP_ONLINE_TESTS=1
@@ -368,6 +369,9 @@ fi
%changelog
+* Thu Jun 6 2019 Remi Collet <remi@remirepo.net> - 3.2.0-5
+- add upstream patch for 7.4
+
* Thu Mar 7 2019 Remi Collet <remi@remirepo.net> - 3.2.0-4
- rebuild with libicu62