diff options
Diffstat (limited to '16.patch')
-rw-r--r-- | 16.patch | 143 |
1 files changed, 142 insertions, 1 deletions
@@ -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; |