From d256a74edfec7568501fd18e0060f7545124441a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 8 Oct 2024 10:43:15 +0200 Subject: update to 2.0.9 drop patches merged upstream --- 0001-restore-7.0-compatibility.patch | 28 ++++++++++ PHPINFO | 2 +- REFLECTION | 103 ++++++++++++++++++++++++----------- oauth-pcre.patch | 23 -------- oauth-php82.patch | 85 ----------------------------- oauth-php84.patch | 100 ---------------------------------- php-pecl-oauth.spec | 19 +++---- 7 files changed, 107 insertions(+), 253 deletions(-) create mode 100644 0001-restore-7.0-compatibility.patch delete mode 100644 oauth-pcre.patch delete mode 100644 oauth-php82.patch delete mode 100644 oauth-php84.patch diff --git a/0001-restore-7.0-compatibility.patch b/0001-restore-7.0-compatibility.patch new file mode 100644 index 0000000..766e600 --- /dev/null +++ b/0001-restore-7.0-compatibility.patch @@ -0,0 +1,28 @@ +From 70f260f6e395af7c6061e2b07ea91b85b28532f1 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 8 Oct 2024 10:31:48 +0200 +Subject: [PATCH] restore 7.0 compatibility + +--- + provider.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/provider.c b/provider.c +index f1f8e2a..5f988b5 100644 +--- a/provider.c ++++ b/provider.c +@@ -960,7 +960,11 @@ SOP_METHOD(generateToken) + php_error_docref(NULL, E_WARNING, "Could not gather enough random data, falling back on rand()"); + } + while (reaped < size) { ++#if PHP_VERSION_ID < 70100 ++ iv[reaped++] = (char) (255.0 * php_rand() / RAND_MAX); ++#else + iv[reaped++] = (char)php_mt_rand_range(0, 255); ++#endif + } + } + +-- +2.46.2 + diff --git a/PHPINFO b/PHPINFO index e6227ed..9bd2472 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.7 +version => 2.0.9 diff --git a/REFLECTION b/REFLECTION index 751797f..466198f 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #117 OAuth version 2.0.7 ] { +Extension [ extension #88 OAuth version 2.0.9 ] { - Constants [32] { Constant [ string OAUTH_SIG_METHOD_HMACSHA1 ] { HMAC-SHA1 } @@ -47,7 +47,7 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [3] { Parameter #0 [ $http_method ] Parameter #1 [ $uri ] - Parameter #2 [ $parameters ] + Parameter #2 [ $parameters = ] } } } @@ -65,9 +65,9 @@ Extension [ extension #117 OAuth version 2.0.7 ] { } - Properties [3] { - Property [ public $debug ] - Property [ public $sslChecks ] - Property [ public $debugInfo ] + Property [ public $debug = 0 ] + Property [ public $sslChecks = 1 ] + Property [ public $debugInfo = '' ] } - Methods [26] { @@ -76,8 +76,8 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [4] { Parameter #0 [ $consumer_key ] Parameter #1 [ $consumer_secret ] - Parameter #2 [ $signature_method ] - Parameter #3 [ $auth_type ] + Parameter #2 [ $signature_method = ] + Parameter #3 [ $auth_type = ] } } @@ -90,18 +90,20 @@ Extension [ extension #117 OAuth version 2.0.7 ] { Method [ public method getRequestToken ] { - - Parameters [2] { + - Parameters [3] { Parameter #0 [ $request_token_url ] - Parameter #1 [ $callback_url ] + Parameter #1 [ $callback_url = ] + Parameter #2 [ $http_method = ] } } Method [ public method getAccessToken ] { - - Parameters [3] { + - Parameters [4] { Parameter #0 [ $access_token_url ] - Parameter #1 [ $auth_session_handle ] - Parameter #2 [ $auth_verifier ] + Parameter #1 [ $auth_session_handle = ] + Parameter #2 [ $auth_verifier = ] + Parameter #3 [ $http_method = ] } } @@ -170,9 +172,9 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [4] { Parameter #0 [ $protected_resource_url ] - Parameter #1 [ $extra_parameters ] - Parameter #2 [ $http_method ] - Parameter #3 [ $request_headers ] + Parameter #1 [ $extra_parameters = ] + Parameter #2 [ $http_method = ] + Parameter #3 [ $request_headers = ] } } @@ -231,7 +233,7 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [3] { Parameter #0 [ $http_method ] Parameter #1 [ $url ] - Parameter #2 [ $extra_parameters ] + Parameter #2 [ $extra_parameters = ] } } @@ -254,13 +256,13 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [3] { Parameter #0 [ $http_method ] Parameter #1 [ $url ] - Parameter #2 [ $extra_parameters ] + Parameter #2 [ $extra_parameters = ] } } } } - Class [ class OAuthException extends Exception implements Throwable ] { + Class [ class OAuthException extends Exception implements Throwable, Stringable ] { - Constants [0] { } @@ -272,49 +274,84 @@ Extension [ extension #117 OAuth version 2.0.7 ] { } - Properties [6] { - Property [ protected $message ] - Property [ protected $code ] - Property [ protected $file ] - Property [ protected $line ] - Property [ public $lastResponse ] - Property [ public $debugInfo ] + Property [ protected $message = '' ] + Property [ protected $code = 0 ] + Property [ protected string $file = '' ] + Property [ protected int $line = 0 ] + Property [ public $lastResponse = NULL ] + Property [ public $debugInfo = NULL ] } - Methods [10] { Method [ public method __construct ] { - Parameters [3] { - Parameter #0 [ $message ] - Parameter #1 [ $code ] - Parameter #2 [ $previous ] + Parameter #0 [ string $message = "" ] + Parameter #1 [ int $code = 0 ] + Parameter #2 [ ?Throwable $previous = null ] } } Method [ public method __wakeup ] { + + - Parameters [0] { + } + - Tentative return [ void ] } Method [ final public method getMessage ] { + + - Parameters [0] { + } + - Return [ string ] } Method [ final public method getCode ] { + + - Parameters [0] { + } } Method [ final public method getFile ] { + + - Parameters [0] { + } + - Return [ string ] } Method [ final public method getLine ] { + + - Parameters [0] { + } + - Return [ int ] } Method [ final public method getTrace ] { + + - Parameters [0] { + } + - Return [ array ] } Method [ final public method getPrevious ] { + + - Parameters [0] { + } + - Return [ ?Throwable ] } Method [ final public method getTraceAsString ] { + + - Parameters [0] { + } + - Return [ string ] } - Method [ public method __toString ] { + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] } } } @@ -339,7 +376,7 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [2] { Parameter #0 [ $size ] - Parameter #1 [ $strong ] + Parameter #1 [ $strong = ] } } } @@ -351,7 +388,7 @@ Extension [ extension #117 OAuth version 2.0.7 ] { Method [ public method __construct ] { - Parameters [1] { - Parameter #0 [ $params_array ] + Parameter #0 [ $params_array = ] } } @@ -397,8 +434,8 @@ Extension [ extension #117 OAuth version 2.0.7 ] { Method [ public method checkOAuthRequest ] { - Parameters [2] { - Parameter #0 [ $uri ] - Parameter #1 [ $method ] + Parameter #0 [ $uri = ] + Parameter #1 [ $method = ] } } @@ -427,7 +464,7 @@ Extension [ extension #117 OAuth version 2.0.7 ] { - Parameters [2] { Parameter #0 [ $param_key ] - Parameter #1 [ $param_val ] + Parameter #1 [ $param_val = ] } } diff --git a/oauth-pcre.patch b/oauth-pcre.patch deleted file mode 100644 index 31635ca..0000000 --- a/oauth-pcre.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 2e02631fa424639b10d105ff47e9cf650403cef7 Mon Sep 17 00:00:00 2001 -From: Andy Postnikov -Date: Fri, 18 Sep 2020 16:22:33 +0300 -Subject: [PATCH] Remove pcre.h dependency - -PHP using pcre2 and I see no usage of pcre 1 ---- - config.m4 | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/config.m4 b/config.m4 -index f4a6899..2adf937 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -10,8 +10,6 @@ if test "$PHP_OAUTH" != "no"; then - PHP_NEW_EXTENSION(oauth, oauth.c provider.c, $ext_shared) - CFLAGS="$CFLAGS -Wall -g" - -- AC_CHECK_HEADER(pcre.h, , [AC_MSG_ERROR([Couldn't find pcre.h, try installing the libpcre development/headers package])]) -- - AS_IF([test "x$with_curl" != "xno"], - [ - AC_MSG_CHECKING(for cURL in default path) diff --git a/oauth-php82.patch b/oauth-php82.patch deleted file mode 100644 index ad8eb4a..0000000 --- a/oauth-php82.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 66e8e9cf9805c96dd9aa6a7c08ec0da5c2c6b656 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 9 Sep 2022 14:03:57 +0200 -Subject: [PATCH] fix for php 8.2: declare used properties - ---- - oauth.c | 1 + - provider.c | 13 +++++++++++++ - tests/oauthprovider_001.phpt | 12 ++++++++---- - 3 files changed, 22 insertions(+), 4 deletions(-) - -diff --git a/oauth.c b/oauth.c -index f845893..46eccda 100644 ---- a/oauth.c -+++ b/oauth.c -@@ -2781,6 +2781,7 @@ PHP_MINIT_FUNCTION(oauth) - soo_exception_ce = zend_register_internal_class_ex(&soo_ex_ce, zend_exception_get_default()); - zend_declare_property_null(soo_exception_ce, "lastResponse", sizeof("lastResponse")-1, ZEND_ACC_PUBLIC); - zend_declare_property_null(soo_exception_ce, "debugInfo", sizeof("debugInfo")-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(soo_exception_ce, "additionalInfo", sizeof("additionalInfo")-1, ZEND_ACC_PUBLIC); - - REGISTER_STRING_CONSTANT("OAUTH_SIG_METHOD_HMACSHA1", OAUTH_SIG_METHOD_HMACSHA1, CONST_CS | CONST_PERSISTENT); - REGISTER_STRING_CONSTANT("OAUTH_SIG_METHOD_HMACSHA256", OAUTH_SIG_METHOD_HMACSHA256, CONST_CS | CONST_PERSISTENT); -diff --git a/provider.c b/provider.c -index 45880fb..43f2bc0 100644 ---- a/provider.c -+++ b/provider.c -@@ -1184,6 +1184,19 @@ extern int oauth_provider_register_class(void) /* {{{ */ - osce.create_object = oauth_provider_new; - oauthprovider = zend_register_internal_class(&osce); - -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_CONSUMER_KEY, sizeof(OAUTH_PROVIDER_CONSUMER_KEY)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_CONSUMER_SECRET, sizeof(OAUTH_PROVIDER_CONSUMER_SECRET)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_SIGNATURE, sizeof(OAUTH_PROVIDER_SIGNATURE)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_SIGNATURE_METHOD, sizeof(OAUTH_PROVIDER_SIGNATURE_METHOD)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_TOKEN, sizeof(OAUTH_PROVIDER_TOKEN)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_TOKEN_SECRET, sizeof(OAUTH_PROVIDER_TOKEN_SECRET)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_NONCE, sizeof(OAUTH_PROVIDER_NONCE)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_TIMESTAMP, sizeof(OAUTH_PROVIDER_TIMESTAMP)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_VERSION, sizeof(OAUTH_PROVIDER_VERSION)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_CALLBACK, sizeof(OAUTH_PROVIDER_CALLBACK)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, OAUTH_PROVIDER_VERIFIER, sizeof(OAUTH_PROVIDER_VERIFIER)-1, ZEND_ACC_PUBLIC); -+ zend_declare_property_null(oauthprovider, "request_token_endpoint", sizeof("request_token_endpoint")-1, ZEND_ACC_PUBLIC); -+ - memcpy(&oauth_provider_obj_hndlrs, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - oauth_provider_obj_hndlrs.offset = XtOffsetOf(php_oauth_provider, zo); - oauth_provider_obj_hndlrs.free_obj = oauth_provider_free_storage; -diff --git a/tests/oauthprovider_001.phpt b/tests/oauthprovider_001.phpt -index e93af65..ab005c4 100644 ---- a/tests/oauthprovider_001.phpt -+++ b/tests/oauthprovider_001.phpt -@@ -6,25 +6,29 @@ $provider = new OAuthProvider(['foo' => 'bar']); - var_dump($provider); - - --EXPECT-- --object(OAuthProvider)#1 (10) { -+object(OAuthProvider)#1 (12) { - ["consumer_key"]=> - NULL - ["consumer_secret"]=> - NULL -- ["nonce"]=> -+ ["signature"]=> -+ NULL -+ ["signature_method"]=> - NULL - ["token"]=> - NULL - ["token_secret"]=> - NULL -+ ["nonce"]=> -+ NULL - ["timestamp"]=> - NULL - ["version"]=> - NULL -- ["signature_method"]=> -- NULL - ["callback"]=> - NULL -+ ["verifier"]=> -+ NULL - ["request_token_endpoint"]=> - bool(false) - } diff --git a/oauth-php84.patch b/oauth-php84.patch deleted file mode 100644 index 3eacf17..0000000 --- a/oauth-php84.patch +++ /dev/null @@ -1,100 +0,0 @@ -From e7f262becf3feb65c8195fff4591d9dbd8acbace Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 9 Jul 2024 15:09:40 +0200 -Subject: [PATCH 1/2] fix for PHP 8.4 - ---- - oauth.c | 2 +- - php_oauth.h | 6 +++++- - provider.c | 6 +++++- - 3 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/oauth.c b/oauth.c -index 46fe08b..9bd8d2a 100644 ---- a/oauth.c -+++ b/oauth.c -@@ -1330,7 +1330,7 @@ static void make_standard_query(HashTable *ht, php_so_object *soo) /* {{{ */ - gettimeofday((struct timeval *) &tv, (struct timezone *) NULL); - sec = (int) tv.tv_sec; - usec = (int) (tv.tv_usec % 0x100000); -- spprintf(&nonce, 0, "%ld%08x%05x%.8f", php_rand(), sec, usec, php_combined_lcg() * 10); -+ spprintf(&nonce, 0, "%d%08x%05x%.8f", php_mt_rand(), sec, usec, php_combined_lcg() * 10); - } - - add_arg_for_req(ht, OAUTH_PARAM_CONSUMER_KEY, Z_STRVAL_P(soo_get_property(soo, OAUTH_ATTR_CONSUMER_KEY))); -diff --git a/php_oauth.h b/php_oauth.h -index e5a1225..63a29ec 100644 ---- a/php_oauth.h -+++ b/php_oauth.h -@@ -29,7 +29,12 @@ - #include "php_main.h" - #include "php_ini.h" - #include "ext/standard/php_string.h" -+#if PHP_VERSION_ID < 80400 - #include "ext/standard/php_rand.h" -+#include "ext/standard/php_lcg.h" -+#else -+#include "ext/random/php_random.h" -+#endif - #include "ext/standard/php_smart_string.h" - #include "ext/standard/info.h" - #include "ext/standard/php_string.h" -@@ -41,7 +46,6 @@ - #include "php_globals.h" - #include "ext/standard/file.h" - #include "ext/standard/base64.h" --#include "ext/standard/php_lcg.h" - #include "ext/pcre/php_pcre.h" - #include "php_network.h" - -diff --git a/provider.c b/provider.c -index cd853f0..f1f8e2a 100644 ---- a/provider.c -+++ b/provider.c -@@ -235,8 +235,12 @@ static int oauth_provider_parse_auth_header(php_oauth_provider *sop, char *auth_ - #endif - &return_value, - &subpats, -+#if PHP_VERSION_ID < 80400 - 1, /* global */ - 1, /* use flags */ -+#else -+ true, /* global */ -+#endif - 2, /* PREG_SET_ORDER */ - 0 - ); -@@ -956,7 +960,7 @@ SOP_METHOD(generateToken) - php_error_docref(NULL, E_WARNING, "Could not gather enough random data, falling back on rand()"); - } - while (reaped < size) { -- iv[reaped++] = (char) (255.0 * php_rand() / RAND_MAX); -+ iv[reaped++] = (char)php_mt_rand_range(0, 255); - } - } - - -From 95f349152e6e0797068970ca7e6b265310316c0f Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Mon, 30 Sep 2024 09:36:58 +0200 -Subject: [PATCH 2/2] use zend_str_tolower - ---- - oauth.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/oauth.c b/oauth.c -index 9bd8d2a..24c60c9 100644 ---- a/oauth.c -+++ b/oauth.c -@@ -599,8 +599,8 @@ zend_string *oauth_generate_sig_base(php_so_object *soo, const char *http_method - php_url_free(urlparts); - return NULL; - } -- php_strtolower(OAUTH_URL_STR(urlparts->scheme), OAUTH_URL_LEN(urlparts->scheme)); -- php_strtolower(OAUTH_URL_STR(urlparts->host), OAUTH_URL_LEN(urlparts->host)); -+ zend_str_tolower(OAUTH_URL_STR(urlparts->scheme), OAUTH_URL_LEN(urlparts->scheme)); -+ zend_str_tolower(OAUTH_URL_STR(urlparts->host), OAUTH_URL_LEN(urlparts->host)); - smart_string_appends(&sbuf, OAUTH_URL_STR(urlparts->scheme)); - smart_string_appends(&sbuf, "://"); - smart_string_appends(&sbuf, OAUTH_URL_STR(urlparts->host)); diff --git a/php-pecl-oauth.spec b/php-pecl-oauth.spec index 0b92684..c21426c 100644 --- a/php-pecl-oauth.spec +++ b/php-pecl-oauth.spec @@ -20,20 +20,17 @@ %global _configure ../%{sources}/configure Name: %{?scl_prefix}php-pecl-oauth -Version: 2.0.7 -Release: 11%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Version: 2.0.9 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: PHP OAuth consumer extension License: BSD-3-Clause URL: https://pecl.php.net/package/oauth Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz -Patch0: %{pecl_name}-pcre.patch -Patch1: %{pecl_name}-php82.patch -Patch2: %{pecl_name}-php84.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel >= 7 +# see https://github.com/php/pecl-web_services-oauth/pull/31 +BuildRequires: %{?scl_prefix}php-devel >= 7.1 BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-posix BuildRequires: pcre-devel @@ -67,10 +64,6 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd %{sources} -%patch -P0 -p1 -b .up -%patch -P1 -p1 -b .pr24 -%patch -P2 -p1 -b .pr30 - #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) @@ -173,6 +166,10 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Tue Oct 8 2024 Remi Collet - 2.0.9-1 +- update to 2.0.9 +- drop patches merged upstream + * Mon Sep 30 2024 Remi Collet - 2.0.7-11 - more patch for 8.4 -- cgit