summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-09-18 09:27:15 +0200
committerRemi Collet <remi@remirepo.net>2020-09-18 09:27:15 +0200
commit97202795b4490250027445b63678f6b2ffd3ef6f (patch)
treef38a56a6feea250aeab799f9aec69c90ea971cd1
parent041fff812c05a1f639ceeceeeb8ca98bdf7800d8 (diff)
update to 2.0.7
drop patch merged upstream
-rw-r--r--16.patch686
-rw-r--r--PHPINFO2
-rw-r--r--REFLECTION2
-rw-r--r--php-pecl-oauth.spec12
4 files changed, 8 insertions, 694 deletions
diff --git a/16.patch b/16.patch
deleted file mode 100644
index 9ec78e9..0000000
--- a/16.patch
+++ /dev/null
@@ -1,686 +0,0 @@
-From 696702c57c3ca47ebe139284d7140f21dd335be3 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@php.net>
-Date: Thu, 10 Sep 2020 11:35:13 +0200
-Subject: [PATCH 1/3] work for PHP 8
-
----
- oauth.c | 87 +++++++++++++++++++++++++--------------
- php_oauth.h | 20 +++++----
- provider.c | 44 ++++++++++----------
- provider.h | 4 +-
- tests/oauth_sbs.phpt | 10 +++--
- tests/oauth_standard.phpt | 6 +--
- tests/sbs.phpt | 10 +++--
- 7 files changed, 109 insertions(+), 72 deletions(-)
-
-diff --git a/oauth.c b/oauth.c
-index b731216..5f92194 100644
---- a/oauth.c
-+++ b/oauth.c
-@@ -33,9 +33,15 @@ static zend_object* php_so_object_new(zend_class_entry *ce) /* {{{ */
- }
- /* }}} */
-
-+#if PHP_VERSION_ID < 80000
- static zend_object *oauth_clone_obj(zval *this_ptr) /* {{{ */
- {
- php_so_object *old_obj = Z_SOO_P(this_ptr);
-+#else
-+static zend_object *oauth_clone_obj(zend_object *this_ptr) /* {{{ */
-+{
-+ php_so_object *old_obj = so_object_from_obj(this_ptr);
-+#endif
- php_so_object *new_obj = so_object_from_obj(php_so_object_new(old_obj->zo.ce));
-
- zend_objects_clone_members(&new_obj->zo, &old_obj->zo);
-@@ -176,20 +182,20 @@ void soo_handle_error(php_so_object *soo, long errorCode, char *msg, char *respo
- if (!errorCode) {
- php_error(E_WARNING, "caller did not pass an errorcode!");
- } else {
-- zend_update_property_long(dex, &ex, "code", sizeof("code")-1, errorCode);
-+ zend_update_property_long(dex, OBJ_FOR_PROP(&ex), "code", sizeof("code")-1, errorCode);
- }
- if (response) {
-- zend_update_property_string(dex, &ex, "lastResponse", sizeof("lastResponse")-1, response);
-+ zend_update_property_string(dex, OBJ_FOR_PROP(&ex), "lastResponse", sizeof("lastResponse")-1, response);
- }
- if(soo && soo->debug && Z_TYPE(soo->debugArr) != IS_UNDEF) {
-- zend_update_property(dex, &ex, "debugInfo", sizeof("debugInfo") - 1, &soo->debugArr);
-+ zend_update_property(dex, OBJ_FOR_PROP(&ex), "debugInfo", sizeof("debugInfo") - 1, &soo->debugArr);
- }
-
- if(additional_info) {
-- zend_update_property_string(dex, &ex, "additionalInfo", sizeof("additionalInfo")-1, additional_info);
-+ zend_update_property_string(dex, OBJ_FOR_PROP(&ex), "additionalInfo", sizeof("additionalInfo")-1, additional_info);
- }
-
-- zend_update_property_string(dex, &ex, "message", sizeof("message")-1, msg);
-+ zend_update_property_string(dex, OBJ_FOR_PROP(&ex), "message", sizeof("message")-1, msg);
- zend_throw_exception_object(&ex);
- }
- /* }}} */
-@@ -249,7 +255,7 @@ zend_string *soo_sign_rsa(php_so_object *soo, char *message, const oauth_sig_con
- ZVAL_NULL(&args[1]);
- ZVAL_DUP(&args[2], &ctx->privatekey);
-
-- call_user_function_ex(EG(function_table), NULL, &func, &retval, 3, args, 0, NULL);
-+ call_user_function(EG(function_table), NULL, &func, &retval, 3, args);
-
- if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) {
- result = php_base64_encode((unsigned char *) Z_STRVAL_P(Z_REFVAL(args[1])), Z_STRLEN_P(Z_REFVAL(args[1])));
-@@ -373,23 +379,31 @@ static int oauth_strcmp(zval *first, zval *second) /* {{{ */
- }
- /* }}} */
-
-+#if PHP_VERSION_ID < 80000
- static int oauth_compare_value(const void *a, const void *b) /* {{{ */
- {
- Bucket *f, *s;
- f = (Bucket *)a;
- s = (Bucket *)b;
-
-+#else
-+static int oauth_compare_value(Bucket *f, Bucket *s) /* {{{ */
-+{
-+#endif
- return oauth_strcmp(&f->val, &s->val);
- }
- /* }}} */
-
-+#if PHP_VERSION_ID < 80000
- static int oauth_compare_key(const void *a, const void *b) /* {{{ */
- {
-+ Bucket *f = (Bucket *)a, *s = (Bucket *)b;
-+#else
-+static int oauth_compare_key(Bucket *f, Bucket *s) /* {{{ */
-+{
-+#endif
- zval first, second;
- int result;
-- Bucket *f, *s;
-- f = (Bucket *) a;
-- s = (Bucket *) b;
-
- if (f->key == NULL) {
- ZVAL_LONG(&first, f->h);
-@@ -691,7 +705,7 @@ static void oauth_set_debug_info(php_so_object *soo) /* {{{ */
- ADD_DEBUG_INFO(debugInfo, "body_recv", soo->debug_info->body_in, 0);
- ADD_DEBUG_INFO(debugInfo, "info", soo->debug_info->curl_info, 0);
-
-- zend_update_property(soo_class_entry, soo->this_ptr, "debugInfo", sizeof("debugInfo") - 1, debugInfo);
-+ zend_update_property(soo_class_entry, OBJ_FOR_PROP(soo->this_ptr), "debugInfo", sizeof("debugInfo") - 1, debugInfo);
- } else {
- ZVAL_UNDEF(&soo->debugArr);
- }
-@@ -815,7 +829,7 @@ static long make_req_streams(php_so_object *soo, const char *url, const smart_st
- zend_hash_move_forward_ex(request_headers, &pos)) {
- /* check if a string based key is used */
- smart_string sheaderline = {0};
-- switch (zend_hash_get_current_key_ex(request_headers, &cur_key, &num_key, &pos)) {
-+ switch ((int)zend_hash_get_current_key_ex(request_headers, &cur_key, &num_key, &pos)) {
- case HASH_KEY_IS_STRING:
- smart_string_appendl(&sheaderline, ZSTR_VAL(cur_key), ZSTR_LEN(cur_key));
- break;
-@@ -1061,7 +1075,7 @@ long make_req_curl(php_so_object *soo, const char *url, const smart_string *payl
- (cur_val = zend_hash_get_current_data_ex(request_headers, &pos)) != NULL;
- zend_hash_move_forward_ex(request_headers, &pos)) {
- /* check if a string based key is used */
-- switch (zend_hash_get_current_key_ex(request_headers, &cur_key, &num_key, &pos)) {
-+ switch ((int)zend_hash_get_current_key_ex(request_headers, &cur_key, &num_key, &pos)) {
- case HASH_KEY_IS_STRING:
- smart_string_appendl(&sheader, ZSTR_VAL(cur_key), ZSTR_LEN(cur_key));
- break;
-@@ -1797,11 +1811,13 @@ SO_METHOD(__construct)
- INIT_smart_string(soo->headers_in);
-
- /* set default class members */
-- zend_update_property_null(soo_class_entry, obj, "debugInfo", sizeof("debugInfo") - 1);
-- zend_update_property_bool(soo_class_entry, obj, "debug", sizeof("debug") - 1, soo->debug);
-- zend_update_property_long(soo_class_entry, obj, "sslChecks", sizeof("sslChecks") - 1, soo->sslcheck);
-+ zend_update_property_null(soo_class_entry, OBJ_FOR_PROP(obj), "debugInfo", sizeof("debugInfo") - 1);
-+ zend_update_property_bool(soo_class_entry, OBJ_FOR_PROP(obj), "debug", sizeof("debug") - 1, soo->debug);
-+ zend_update_property_long(soo_class_entry, OBJ_FOR_PROP(obj), "sslChecks", sizeof("sslChecks") - 1, soo->sslcheck);
-
-+#if PHP_VERSION_ID < 80000
- TSRMLS_SET_CTX(soo->thread_ctx);
-+#endif
-
- if (!sig_method_len) {
- sig_method = OAUTH_SIG_METHOD_HMACSHA1;
-@@ -2046,7 +2062,7 @@ SO_METHOD(disableDebug)
- }
-
- soo->debug = 0;
-- zend_update_property_bool(soo_class_entry, obj, "debug", sizeof("debug") - 1, 0);
-+ zend_update_property_bool(soo_class_entry, OBJ_FOR_PROP(obj), "debug", sizeof("debug") - 1, 0);
-
- RETURN_TRUE;
- }
-@@ -2067,7 +2083,7 @@ SO_METHOD(enableDebug)
- }
-
- soo->debug = 1;
-- zend_update_property_bool(soo_class_entry, obj, "debug", sizeof("debug") - 1, 1);
-+ zend_update_property_bool(soo_class_entry, OBJ_FOR_PROP(obj), "debug", sizeof("debug") - 1, 1);
-
- RETURN_TRUE;
- }
-@@ -2088,7 +2104,7 @@ SO_METHOD(enableSSLChecks)
- }
-
- soo->sslcheck = OAUTH_SSLCHECK_BOTH;
-- zend_update_property_long(soo_class_entry, obj, "sslChecks", sizeof("sslChecks") - 1, 1);
-+ zend_update_property_long(soo_class_entry, OBJ_FOR_PROP(obj), "sslChecks", sizeof("sslChecks") - 1, 1);
-
- RETURN_TRUE;
- }
-@@ -2109,7 +2125,7 @@ SO_METHOD(disableSSLChecks)
- }
-
- soo->sslcheck = OAUTH_SSLCHECK_NONE;
-- zend_update_property_long(soo_class_entry, obj, "sslChecks", sizeof("sslChecks") - 1, 0);
-+ zend_update_property_long(soo_class_entry, OBJ_FOR_PROP(obj), "sslChecks", sizeof("sslChecks") - 1, 0);
-
- RETURN_TRUE;
- }
-@@ -2132,7 +2148,7 @@ SO_METHOD(setSSLChecks)
-
- soo->sslcheck = sslcheck & OAUTH_SSLCHECK_BOTH;
-
-- zend_update_property_long(soo_class_entry, obj, "sslChecks", sizeof("sslChecks") - 1,
-+ zend_update_property_long(soo_class_entry, OBJ_FOR_PROP(obj), "sslChecks", sizeof("sslChecks") - 1,
- soo->sslcheck);
-
- RETURN_TRUE;
-@@ -2671,24 +2687,32 @@ static zend_function_entry so_functions[] = { /* {{{ */
- /* }}} */
-
-
-+#if PHP_VERSION_ID < 80000
- zval *oauth_read_member(zval *obj, zval *mem, int type, void **cache_slot, zval *rv) /* {{{ */
- {
-+ php_so_object *soo = Z_SOO_P(obj);
-+ char *name = Z_STRVAL_P(mem);
-+#else
-+zval *oauth_read_member(zend_object *obj, zend_string *mem, int type, void **cache_slot, zval *rv) /* {{{ */
-+{
-+ php_so_object *soo = so_object_from_obj(obj);
-+ char *name = ZSTR_VAL(mem);
-+#endif
- zval *return_value = NULL;
-- php_so_object *soo;
--
-- soo = Z_SOO_P(obj);
-
- return_value = std_object_handlers.read_property(obj, mem, type, cache_slot, rv);
-
-- if(!strcasecmp(Z_STRVAL_P(mem),"debug")) {
-+ if(!strcasecmp(name, "debug")) {
- convert_to_boolean(return_value);
- ZVAL_BOOL(return_value, soo->debug);
-- } else if(!strcasecmp(Z_STRVAL_P(mem),"sslChecks")) {
-+ } else if(!strcasecmp(name, "sslChecks")) {
- ZVAL_LONG(return_value, soo->sslcheck);
- }
- return return_value;
- } /* }}} */
-
-+
-+#if PHP_VERSION_ID < 80000
- static
- #if PHP_VERSION_ID >= 70400
- zval *
-@@ -2697,11 +2721,14 @@ void
- #endif
- oauth_write_member(zval *obj, zval *mem, zval *value, void **cache_slot) /* {{{ */
- {
-- char *property;
-- php_so_object *soo;
--
-- property = Z_STRVAL_P(mem);
-- soo = Z_SOO_P(obj);
-+ php_so_object *soo = Z_SOO_P(obj);
-+ char *property = Z_STRVAL_P(mem);
-+#else
-+static zval *oauth_write_member(zend_object *obj, zend_string *mem, zval *value, void **cache_slot) /* {{{ */
-+{
-+ php_so_object *soo = so_object_from_obj(obj);
-+ char *property = ZSTR_VAL(mem);
-+#endif
-
- if(!strcmp(property,"debug")) {
- soo->debug = Z_TYPE_P(value) == IS_TRUE ? 1 : 0;
-diff --git a/php_oauth.h b/php_oauth.h
-index d5614c4..e472a26 100644
---- a/php_oauth.h
-+++ b/php_oauth.h
-@@ -251,11 +251,11 @@ static inline php_so_object *Z_SOO_P(zval *zv) /* {{{ */ {
-
- #ifndef zend_parse_parameters_none
- #define zend_parse_parameters_none() \
-- zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
-+ zend_parse_parameters(ZEND_NUM_ARGS(), "")
- #endif
-
--void soo_handle_error(php_so_object *soo, long errorCode, char *msg, char *response, char *additional_info TSRMLS_DC);
--zend_string *oauth_generate_sig_base(php_so_object *soo, const char *http_method, const char *uri, HashTable *post_args, HashTable *extra_args TSRMLS_DC);
-+void soo_handle_error(php_so_object *soo, long errorCode, char *msg, char *response, char *additional_info);
-+zend_string *oauth_generate_sig_base(php_so_object *soo, const char *http_method, const char *uri, HashTable *post_args, HashTable *extra_args);
-
- #ifndef zend_hash_quick_del
- #define HASH_DEL_KEY_QUICK 2
-@@ -318,15 +318,15 @@ zend_string *oauth_generate_sig_base(php_so_object *soo, const char *http_method
- #define OAUTH_OK SUCCESS
-
- #if OAUTH_USE_CURL
--long make_req_curl(php_so_object *soo, const char *url, const smart_string *payload, const char *http_method, HashTable *request_headers TSRMLS_DC);
-+long make_req_curl(php_so_object *soo, const char *url, const smart_string *payload, const char *http_method, HashTable *request_headers);
- #if LIBCURL_VERSION_NUM >= 0x071304
- #define OAUTH_PROTOCOLS_ALLOWED CURLPROTO_HTTP | CURLPROTO_HTTPS
- #endif
- #endif
-
-
--void oauth_free_privatekey(zval *privatekey TSRMLS_DC);
--zend_string *soo_sign(php_so_object *soo, char *message, zval *cs, zval *ts, const oauth_sig_context *ctx TSRMLS_DC);
-+void oauth_free_privatekey(zval *privatekey);
-+zend_string *soo_sign(php_so_object *soo, char *message, zval *cs, zval *ts, const oauth_sig_context *ctx);
- oauth_sig_context *oauth_create_sig_context(const char *sigmethod);
- zend_string *oauth_url_encode(char *url, int url_len);
-
-@@ -340,6 +340,12 @@ zend_string *oauth_url_encode(char *url, int url_len);
- #define OAUTH_URL_LEN(a) ZSTR_LEN(a)
- #endif
-
-+#if PHP_VERSION_ID < 80000
-+#define OBJ_FOR_PROP(zv) (zv)
-+#else
-+#define OBJ_FOR_PROP(zv) Z_OBJ_P(zv)
-+#endif
-+
- #endif
-
- /**
-@@ -350,4 +356,4 @@ zend_string *oauth_url_encode(char *url, int url_len);
- * End:
- * vim600: fdm=marker
- * vim: noet sw=4 ts=4 noexpandtab
-- */
-\ No newline at end of file
-+ */
-diff --git a/provider.c b/provider.c
-index 5e88f5c..e870bae 100644
---- a/provider.c
-+++ b/provider.c
-@@ -24,7 +24,7 @@ static zend_class_entry *oauthprovider;
-
- static inline void oauth_provider_set_param_member(zval *provider_obj, char *prop_name, zval *prop) /* {{{ */
- {
-- zend_update_property(Z_OBJCE_P(provider_obj), provider_obj, prop_name, strlen(prop_name), prop);
-+ zend_update_property(Z_OBJCE_P(provider_obj), OBJ_FOR_PROP(provider_obj), prop_name, strlen(prop_name), prop);
- }
- /* }}} */
-
-@@ -117,7 +117,7 @@ static int oauth_provider_token_required(zval *provider_obj, char* uri)
- {
- zval *is_req_token_api, rv;
-
-- is_req_token_api = zend_read_property(Z_OBJCE_P(provider_obj), provider_obj, "request_token_endpoint", sizeof("request_token_endpoint") - 1, 1, &rv);
-+ is_req_token_api = zend_read_property(Z_OBJCE_P(provider_obj), OBJ_FOR_PROP(provider_obj), "request_token_endpoint", sizeof("request_token_endpoint") - 1, 1, &rv);
-
- if (Z_TYPE_P(is_req_token_api) == IS_FALSE) {
- php_oauth_provider *sop;
-@@ -374,7 +374,7 @@ static zval *oauth_provider_call_cb(INTERNAL_FUNCTION_PARAMETERS, int type) /* {
- }
-
- if (zend_fcall_info_call(cb->fcall_info, &cb->fcall_info_cache, return_value, &args)!=SUCCESS) {
-- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed calling callback %s", Z_STRVAL(cb->fcall_info->function_name));
-+ php_error_docref(NULL, E_ERROR, "Failed calling callback %s", Z_STRVAL(cb->fcall_info->function_name));
- }
-
- zval_ptr_dtor(&args);
-@@ -490,17 +490,17 @@ SOP_METHOD(__construct)
-
- oauth_provider_set_default_required_params(sop->required_params);
-
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_CONSUMER_KEY, sizeof(OAUTH_PROVIDER_CONSUMER_KEY)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_CONSUMER_SECRET, sizeof(OAUTH_PROVIDER_CONSUMER_SECRET)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_NONCE, sizeof(OAUTH_PROVIDER_NONCE)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_TOKEN, sizeof(OAUTH_PROVIDER_TOKEN)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_TOKEN_SECRET, sizeof(OAUTH_PROVIDER_TOKEN_SECRET)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_TIMESTAMP, sizeof(OAUTH_PROVIDER_TIMESTAMP)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_VERSION, sizeof(OAUTH_PROVIDER_VERSION)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_SIGNATURE_METHOD, sizeof(OAUTH_PROVIDER_SIGNATURE_METHOD)-1);
-- zend_update_property_null(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_CALLBACK, sizeof(OAUTH_PROVIDER_CALLBACK)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_CONSUMER_KEY, sizeof(OAUTH_PROVIDER_CONSUMER_KEY)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_CONSUMER_SECRET, sizeof(OAUTH_PROVIDER_CONSUMER_SECRET)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_NONCE, sizeof(OAUTH_PROVIDER_NONCE)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_TOKEN, sizeof(OAUTH_PROVIDER_TOKEN)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_TOKEN_SECRET, sizeof(OAUTH_PROVIDER_TOKEN_SECRET)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_TIMESTAMP, sizeof(OAUTH_PROVIDER_TIMESTAMP)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_VERSION, sizeof(OAUTH_PROVIDER_VERSION)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_SIGNATURE_METHOD, sizeof(OAUTH_PROVIDER_SIGNATURE_METHOD)-1);
-+ zend_update_property_null(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_CALLBACK, sizeof(OAUTH_PROVIDER_CALLBACK)-1);
-
-- zend_update_property_bool(Z_OBJCE_P(pthis), pthis, "request_token_endpoint", sizeof("request_token_endpoint")-1, 0);
-+ zend_update_property_bool(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), "request_token_endpoint", sizeof("request_token_endpoint")-1, 0);
-
- if(!param_count) {
- /* TODO: support NSAPI */
-@@ -632,7 +632,7 @@ SOP_METHOD(isRequestTokenEndpoint)
- return;
- }
-
-- zend_update_property_bool(Z_OBJCE_P(pthis), pthis, "request_token_endpoint", sizeof("request_token_endpoint") - 1, req_api);
-+ zend_update_property_bool(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), "request_token_endpoint", sizeof("request_token_endpoint") - 1, req_api);
- }
- /* }}} */
-
-@@ -734,7 +734,7 @@ SOP_METHOD(checkOAuthRequest)
- return;
- }
-
-- sig_method = zend_read_property(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_SIGNATURE_METHOD, sizeof(OAUTH_PROVIDER_SIGNATURE_METHOD) - 1, 1, &rv);
-+ sig_method = zend_read_property(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_SIGNATURE_METHOD, sizeof(OAUTH_PROVIDER_SIGNATURE_METHOD) - 1, 1, &rv);
- do {
- if (sig_method && (Z_TYPE_P(sig_method) == IS_STRING) && Z_STRLEN_P(sig_method)) {
- sig_ctx = oauth_create_sig_context(Z_STRVAL_P(sig_method));
-@@ -803,16 +803,16 @@ SOP_METHOD(checkOAuthRequest)
- sbs = oauth_generate_sig_base(NULL, http_verb, uri, sbs_vars, NULL);
-
- if (sbs) {
-- consumer_secret = zend_read_property(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_CONSUMER_SECRET, sizeof(OAUTH_PROVIDER_CONSUMER_SECRET) - 1, 1, &rv);
-+ consumer_secret = zend_read_property(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_CONSUMER_SECRET, sizeof(OAUTH_PROVIDER_CONSUMER_SECRET) - 1, 1, &rv);
- convert_to_string_ex(consumer_secret);
- if (is_token_required) {
-- token_secret = zend_read_property(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_TOKEN_SECRET, sizeof(OAUTH_PROVIDER_TOKEN_SECRET) - 1, 1, &rv);
-+ token_secret = zend_read_property(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_TOKEN_SECRET, sizeof(OAUTH_PROVIDER_TOKEN_SECRET) - 1, 1, &rv);
- convert_to_string_ex(token_secret);
- }
- signature = soo_sign(NULL, ZSTR_VAL(sbs), consumer_secret, token_secret, sig_ctx);
- }
-
-- req_signature = zend_read_property(Z_OBJCE_P(pthis), pthis, OAUTH_PROVIDER_SIGNATURE, sizeof(OAUTH_PROVIDER_SIGNATURE) - 1, 1, &rv);
-+ req_signature = zend_read_property(Z_OBJCE_P(pthis), OBJ_FOR_PROP(pthis), OAUTH_PROVIDER_SIGNATURE, sizeof(OAUTH_PROVIDER_SIGNATURE) - 1, 1, &rv);
- if (!signature || !Z_STRLEN_P(req_signature) || strcmp(ZSTR_VAL(signature), Z_STRVAL_P(req_signature))) {
- soo_handle_error(NULL, OAUTH_INVALID_SIGNATURE, "Signatures do not match", NULL, sbs ? ZSTR_VAL(sbs) : NULL);
- }
-@@ -984,7 +984,7 @@ SOP_METHOD(reportProblem)
- }
-
- /* XXX good candidate for refactoring */
-- code = zend_read_property(Z_OBJCE_P(exception), exception, "code", sizeof("code") - 1, 1, &rv);
-+ code = zend_read_property(Z_OBJCE_P(exception), OBJ_FOR_PROP(exception), "code", sizeof("code") - 1, 1, &rv);
- lcode = Z_LVAL_P(code);
-
- switch(lcode) {
-@@ -1018,7 +1018,7 @@ SOP_METHOD(reportProblem)
- case OAUTH_INVALID_SIGNATURE:
- http_code = OAUTH_ERR_BAD_AUTH;
- out = "oauth_problem=signature_invalid";
-- sbs = zend_read_property(Z_OBJCE_P(exception), exception, "additionalInfo", sizeof("additionalInfo") - 1, 1, &rv);
-+ sbs = zend_read_property(Z_OBJCE_P(exception), OBJ_FOR_PROP(exception), "additionalInfo", sizeof("additionalInfo") - 1, 1, &rv);
- if (sbs && IS_NULL!=Z_TYPE_P(sbs)) {
- convert_to_string_ex(sbs);
- if(Z_STRLEN_P(sbs)) {
-@@ -1037,7 +1037,7 @@ SOP_METHOD(reportProblem)
- case OAUTH_PARAMETER_ABSENT:
- http_code = OAUTH_ERR_BAD_REQUEST;
- out = "oauth_problem=parameter_absent";
-- missing_params = zend_read_property(Z_OBJCE_P(exception), exception, "additionalInfo", sizeof("additionalInfo") - 1, 1, &rv);
-+ missing_params = zend_read_property(Z_OBJCE_P(exception), OBJ_FOR_PROP(exception), "additionalInfo", sizeof("additionalInfo") - 1, 1, &rv);
- if(missing_params) {
- convert_to_string_ex(missing_params);
- if(Z_STRLEN_P(missing_params)) {
-@@ -1176,7 +1176,7 @@ static zend_function_entry oauth_provider_methods[] = { /* {{{ */
- {NULL, NULL, NULL}
- };
-
--extern int oauth_provider_register_class() /* {{{ */
-+extern int oauth_provider_register_class(void) /* {{{ */
- {
- zend_class_entry osce;
-
-diff --git a/provider.h b/provider.h
-index aa9d61b..90ec01a 100644
---- a/provider.h
-+++ b/provider.h
-@@ -47,7 +47,7 @@
- } \
-
- #define OAUTH_PROVIDER_CHECK_PARAMS(s, r) \
-- if(oauth_provider_check_sapi(s, TRUE TSRMLS_CC)) { \
-+ if(oauth_provider_check_sapi(s, TRUE)) { \
- if(r) {\
- RETURN_FALSE\
- } \
-@@ -110,7 +110,7 @@ static inline php_oauth_provider *sop_object_from_obj(zend_object *obj) /* {{{ *
- #define Z_SOP_P(zv) sop_object_from_obj(Z_OBJ_P((zv)))
-
-
--extern int oauth_provider_register_class(TSRMLS_D);
-+extern int oauth_provider_register_class(void);
-
- #define SOP_METHOD(func) PHP_METHOD(oauthprovider, func)
- #define SOP_ME(func, arg_info, flags) PHP_ME(oauthprovider, func, arg_info, flags)
-diff --git a/tests/oauth_sbs.phpt b/tests/oauth_sbs.phpt
-index 4e9269e..6d9bb4c 100644
---- a/tests/oauth_sbs.phpt
-+++ b/tests/oauth_sbs.phpt
-@@ -8,7 +8,11 @@ echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/'),"\n";
- echo "-- using empty array --\n";
- echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/', array()),"\n";
- echo "-- using string instead of array --\n";
--echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/',''),"\n";
-+try {
-+ echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/',''),"\n";
-+} catch (TypeError $e) {
-+ echo $e->getMessage()."\n";
-+}
- echo "-- using numeric keys masked as a string --\n";
- echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/',array('1'=>'hello')),"\n";
- echo "-- using string keys --\n";
-@@ -31,9 +35,7 @@ GET&http%3A%2F%2F127.0.0.1%3A12342%2F&
- -- using empty array --
- GET&http%3A%2F%2F127.0.0.1%3A12342%2F&
- -- using string instead of array --
--
--Warning: oauth_get_sbs() expects parameter 3 to be array, string given in %s
--
-+%Astring given%A
- -- using numeric keys masked as a string --
- GET&http%3A%2F%2F127.0.0.1%3A12342%2F&1%3Dhello
- -- using string keys --
-diff --git a/tests/oauth_standard.phpt b/tests/oauth_standard.phpt
-index 0342f8a..5eb2d57 100644
---- a/tests/oauth_standard.phpt
-+++ b/tests/oauth_standard.phpt
-@@ -61,6 +61,8 @@ try {
- var_dump($x->setVersion());
- } catch (Exception $e) {
- echo "EXCEPTION {$e->getCode()}: {$e->getMessage()}\n";
-+} catch (ArgumentCountError $e) {
-+ echo "EXCEPTION {$e->getCode()}: {$e->getMessage()}\n";
- }
- try {
- echo "-- set version with boolean --\n";
-@@ -115,9 +117,7 @@ OAuth[debug=1,sslChecks=3,debugInfo=]
- -- disable debug --
- OAuth[debug=0,sslChecks=3,debugInfo=]
- -- set version without parameters --
--
--Warning: OAuth::setVersion() expects exactly 1 parameter, 0 given %s
--NULL
-+%A expects exactly 1 parameter, %A
- -- set version with boolean --
- bool(true)
- -- set version with empty string --
-diff --git a/tests/sbs.phpt b/tests/sbs.phpt
-index 1333607..2e8e13b 100644
---- a/tests/sbs.phpt
-+++ b/tests/sbs.phpt
-@@ -8,7 +8,11 @@ echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/'),"\n";
- echo "-- using empty array --\n";
- echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/', array()),"\n";
- echo "-- using string instead of array --\n";
--echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/',''),"\n";
-+try {
-+ echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/',''),"\n";
-+} catch (TypeError $e) {
-+ echo $e->getMessage()."\n";
-+}
- echo "-- using numeric keys masked as a string --\n";
- echo oauth_get_sbs('GET', 'http://127.0.0.1:12342/',array('1'=>'hello')),"\n";
- echo "-- using string keys --\n";
-@@ -29,9 +33,7 @@ GET&http%3A%2F%2F127.0.0.1%3A12342%2F&
- -- using empty array --
- GET&http%3A%2F%2F127.0.0.1%3A12342%2F&
- -- using string instead of array --
--
--Warning: oauth_get_sbs() expects parameter 3 to be array,%sstring given in %s
--
-+%Astring given%A
- -- using numeric keys masked as a string --
- GET&http%3A%2F%2F127.0.0.1%3A12342%2F&1%3Dhello
- -- using string keys --
-
-From 2e304d2702eed50e68b0b52850aabda8531833d1 Mon Sep 17 00:00:00 2001
-From: Michael Wallner <mike@php.net>
-Date: Fri, 18 Sep 2020 08:21:27 +0200
-Subject: [PATCH 2/3] fix test expectations for PHP 8
-
----
- tests/oauth_standard.phpt | 2 +-
- tests/plaintext.phpt | 2 +-
- tests/plaintext2.phpt | 4 ++--
- tests/rsa.phpt | 2 +-
- tests/skip.inc | 5 +++--
- 5 files changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/tests/oauth_standard.phpt b/tests/oauth_standard.phpt
-index 5eb2d57..a267d73 100644
---- a/tests/oauth_standard.phpt
-+++ b/tests/oauth_standard.phpt
-@@ -117,7 +117,7 @@ OAuth[debug=1,sslChecks=3,debugInfo=]
- -- disable debug --
- OAuth[debug=0,sslChecks=3,debugInfo=]
- -- set version without parameters --
--%A expects exactly 1 parameter, %A
-+%A expects exactly 1 %A
- -- set version with boolean --
- bool(true)
- -- set version with empty string --
-diff --git a/tests/plaintext.phpt b/tests/plaintext.phpt
-index 0f72ba5..0d3589e 100644
---- a/tests/plaintext.phpt
-+++ b/tests/plaintext.phpt
-@@ -35,7 +35,7 @@ array(2) {
- ["oauth_token_secret"]=>
- string(4) "4567"
- }
--string(%d) "POST /test?oauth_consumer_key=conskey&oauth_signature_method=PLAINTEXT&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_signature=conssecret%26 HTTP/1.0
-+string(%d) "POST /test?oauth_consumer_key=conskey&oauth_signature_method=PLAINTEXT&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_signature=conssecret%26 HTTP/1.%d
- Host: 127.0.0.1:12342
- Connection: close
-
-diff --git a/tests/plaintext2.phpt b/tests/plaintext2.phpt
-index 702e73c..99982b0 100644
---- a/tests/plaintext2.phpt
-+++ b/tests/plaintext2.phpt
-@@ -44,11 +44,11 @@ array(2) {
- ["oauth_token_secret"]=>
- string(4) "8901"
- }
--string(%d) "POST /test?oauth_consumer_key=conskey&oauth_signature_method=PLAINTEXT&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_token=key&oauth_signature=conssecret%26secret HTTP/1.0
-+string(%d) "POST /test?oauth_consumer_key=conskey&oauth_signature_method=PLAINTEXT&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_token=key&oauth_signature=conssecret%26secret HTTP/1.%d
- Host: 127.0.0.1:12342
- Connection: close
-
--GET /test?oauth_consumer_key=conskey&oauth_signature_method=PLAINTEXT&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_token=key&oauth_signature=conssecret%26secret HTTP/1.0
-+GET /test?oauth_consumer_key=conskey&oauth_signature_method=PLAINTEXT&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_token=key&oauth_signature=conssecret%26secret HTTP/1.%d
- Host: 127.0.0.1:12342
- Connection: close
-
-diff --git a/tests/rsa.phpt b/tests/rsa.phpt
-index 7ef8441..49442fb 100644
---- a/tests/rsa.phpt
-+++ b/tests/rsa.phpt
-@@ -38,7 +38,7 @@ array(2) {
- ["oauth_token_secret"]=>
- string(4) "4567"
- }
--string(%d) "POST /test?oauth_consumer_key=1234&oauth_signature_method=RSA-SHA1&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_signature=AxTdf9nwR0Z54JCKIKAne%2BXKmNtuKerXchcK8axD792sk7cphqMBvNqbPVoJmKYcm0vAkq2ICto0NVz4%2F6WxqA%3D%3D HTTP/1.0
-+string(%d) "POST /test?oauth_consumer_key=1234&oauth_signature_method=RSA-SHA1&oauth_nonce=testing&oauth_timestamp=12345&oauth_version=1.0&oauth_signature=AxTdf9nwR0Z54JCKIKAne%2BXKmNtuKerXchcK8axD792sk7cphqMBvNqbPVoJmKYcm0vAkq2ICto0NVz4%2F6WxqA%3D%3D HTTP/1.%d
- Host: 127.0.0.1:12342
- Connection: close
-
-diff --git a/tests/skip.inc b/tests/skip.inc
-index bca4142..3fac34b 100644
---- a/tests/skip.inc
-+++ b/tests/skip.inc
-@@ -47,7 +47,8 @@ function has_bug($bugid)
- switch ($bugid) {
- case '44603':
- // >= 5.1.0 && < 5.2.6
-- return (PHP_MINOR_VERSION==1 || (PHP_MINOR_VERSION==2 && PHP_RELEASE_VERSION<6));
-+ return (PHP_MAJOR_VERSION==5)
-+ && (PHP_MINOR_VERSION==1 || (PHP_MINOR_VERSION==2 && PHP_RELEASE_VERSION<6));
- }
- return false;
- }
-@@ -66,4 +67,4 @@ function skip_with_bug($bugid)
- }
- }
-
--?>
-+?>
-\ No newline at end of file
-
-From fa5add1e4e290468214be71df5db738d9aef7105 Mon Sep 17 00:00:00 2001
-From: Michael Wallner <mike@php.net>
-Date: Fri, 18 Sep 2020 08:22:35 +0200
-Subject: [PATCH 3/3] PHP 8 fixes
-
-- ext/openssl's private key is an object now
-- pass-by-ref args must be prepared manually
----
- oauth.c | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/oauth.c b/oauth.c
-index 5f92194..f845893 100644
---- a/oauth.c
-+++ b/oauth.c
-@@ -253,12 +253,15 @@ zend_string *soo_sign_rsa(php_so_object *soo, char *message, const oauth_sig_con
-
- ZVAL_STRING(&args[0], message);
- ZVAL_NULL(&args[1]);
-+ ZVAL_MAKE_REF(&args[1]);
- ZVAL_DUP(&args[2], &ctx->privatekey);
-
- call_user_function(EG(function_table), NULL, &func, &retval, 3, args);
-
- if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) {
-- result = php_base64_encode((unsigned char *) Z_STRVAL_P(Z_REFVAL(args[1])), Z_STRLEN_P(Z_REFVAL(args[1])));
-+ zend_string *sig_str = zval_get_string(&args[1]);
-+ result = php_base64_encode((unsigned char *) sig_str->val, sig_str->len);
-+ zend_string_release(sig_str);
- zval_ptr_dtor(&args[1]);
- } else {
- result = NULL;
-@@ -1697,10 +1700,13 @@ SO_METHOD(setRSACertificate)
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&func);
-
-- if (Z_TYPE(retval) == IS_RESOURCE) {
-+ switch (Z_TYPE(retval)) {
-+ case IS_RESOURCE:
-+ case IS_OBJECT:
- OAUTH_SIGCTX_SET_PRIVATEKEY(soo->sig_ctx, retval);
- RETURN_TRUE;
-- } else {
-+ break;
-+ default:
- zval_ptr_dtor(&retval);
- soo_handle_error(soo, OAUTH_ERR_INTERNAL_ERROR, "Could not parse RSA certificate", NULL, NULL);
- return;
diff --git a/PHPINFO b/PHPINFO
index 80ac622..e6227ed 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -6,4 +6,4 @@ PLAINTEXT support => enabled
RSA-SHA1 support => enabled
HMAC-SHA1 support => enabled
Request engine support => php_streams, curl
-version => 2.0.6
+version => 2.0.7
diff --git a/REFLECTION b/REFLECTION
index 051fcee..751797f 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,4 +1,4 @@
-Extension [ <persistent> extension #116 OAuth version 2.0.6 ] {
+Extension [ <persistent> extension #117 OAuth version 2.0.7 ] {
- Constants [32] {
Constant [ string OAUTH_SIG_METHOD_HMACSHA1 ] { HMAC-SHA1 }
diff --git a/php-pecl-oauth.spec b/php-pecl-oauth.spec
index 94b1698..eab213b 100644
--- a/php-pecl-oauth.spec
+++ b/php-pecl-oauth.spec
@@ -21,15 +21,13 @@
%global ini_name 40-%{pecl_name}.ini
Name: %{?sub_prefix}php-pecl-oauth
-Version: 2.0.6
-Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Version: 2.0.7
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Summary: PHP OAuth consumer extension
License: BSD
URL: https://pecl.php.net/package/oauth
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
-Patch0: https://patch-diff.githubusercontent.com/raw/php/pecl-web_services-oauth/pull/16.patch
-
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7
BuildRequires: %{?scl_prefix}php-pear
@@ -98,8 +96,6 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
-%patch0 -p1 -b .pr
-
#sed -e '/PHP_OAUTH_VERSION/s/2.0.3-dev/2.0.3/' -i php_oauth.h
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_OAUTH_VERSION/{s/.* //;s/".*$//;p}' php_oauth.h)
@@ -219,6 +215,10 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Fri Sep 18 2020 Remi Collet <remi@remirepo.net> - 2.0.7-1
+- update to 2.0.7
+- drop patch merged upstream
+
* Fri Sep 18 2020 Remi Collet <remi@remirepo.net> - 2.0.6-3
- more fixes for PHP 8