summaryrefslogtreecommitdiffstats
path: root/oauth-php82.patch
blob: ad8eb4a8c7ecd81640a861822ff511393397d342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 66e8e9cf9805c96dd9aa6a7c08ec0da5c2c6b656 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
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)
 }