summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-09-18 08:49:54 +0200
committerRemi Collet <remi@remirepo.net>2020-09-18 08:49:54 +0200
commit041fff812c05a1f639ceeceeeb8ca98bdf7800d8 (patch)
tree5d19ac2652a463eb148cae3fa085b7f325753107
parentb4d461710eff7fdb89cb5a1dd848f26e691b1f3c (diff)
more fixes for PHP 8
-rw-r--r--16.patch143
-rw-r--r--php-pecl-oauth.spec8
2 files changed, 148 insertions, 3 deletions
diff --git a/16.patch b/16.patch
index 77b15e8..9ec78e9 100644
--- a/16.patch
+++ b/16.patch
@@ -1,7 +1,7 @@
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] work for PHP 8
+Subject: [PATCH 1/3] work for PHP 8
---
oauth.c | 87 +++++++++++++++++++++++++--------------
@@ -543,3 +543,144 @@ index 1333607..2e8e13b 100644
-- 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/php-pecl-oauth.spec b/php-pecl-oauth.spec
index 9668831..94b1698 100644
--- a/php-pecl-oauth.spec
+++ b/php-pecl-oauth.spec
@@ -22,7 +22,7 @@
Name: %{?sub_prefix}php-pecl-oauth
Version: 2.0.6
-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;')}}
Summary: PHP OAuth consumer extension
License: BSD
URL: https://pecl.php.net/package/oauth
@@ -33,6 +33,7 @@ Patch0: https://patch-diff.githubusercontent.com/raw/php/pecl-web_servic
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7
BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: %{?scl_prefix}php-posix
BuildRequires: pcre-devel
BuildRequires: libcurl-devel
@@ -188,7 +189,7 @@ fi
cd NTS
: Upstream test suite for NTS extension
TEST_PHP_EXECUTABLE=%{__php} \
-TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
+TEST_PHP_ARGS="-n -d extension=posix.so -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
%{__php} -n run-tests.php --show-diff
@@ -218,6 +219,9 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Fri Sep 18 2020 Remi Collet <remi@remirepo.net> - 2.0.6-3
+- more fixes for PHP 8
+
* Thu Sep 10 2020 Remi Collet <remi@remirepo.net> - 2.0.6-2
- add fix for PHP 8 from
https://github.com/php/pecl-web_services-oauth/pull/16