summaryrefslogtreecommitdiff
path: root/src/sp_cookie_encryption.c
diff options
context:
space:
mode:
authorjvoisin2025-08-31 16:05:44 +0200
committerjvoisin2025-09-01 13:44:31 +0200
commit508ebee8aff151f147c69d6fbe3ad35301552983 (patch)
treed7d44657f86248764523c9458d2d9f0c14fa520c /src/sp_cookie_encryption.c
parent1c7598c432551d0c49c2c57f249ccd5ccabce638 (diff)
Add support for PHP8.585beta2
Diffstat (limited to 'src/sp_cookie_encryption.c')
-rw-r--r--src/sp_cookie_encryption.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/sp_cookie_encryption.c b/src/sp_cookie_encryption.c
index c833f94..34b1e8f 100644
--- a/src/sp_cookie_encryption.c
+++ b/src/sp_cookie_encryption.c
@@ -45,10 +45,24 @@ static zend_string *encrypt_data(zend_string *data) {
45 return z; 45 return z;
46} 46}
47 47
48/*
49/__w/snuffleupagus/snuffleupagus/src/sp_cookie_encryption.c: In function 'zif_sp_setcookie':
50/__w/snuffleupagus/snuffleupagus/src/sp_cookie_encryption.c:135:7: error: too many arguments to function 'php_head_parse_cookie_options_array'
51 135 | php_head_parse_cookie_options_array(expires_or_options, &expires, &path,
52 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53/__w/snuffleupagus/snuffleupagus/src/sp_cookie_encryption.c:49:13: note: declared here
54 49 | static void php_head_parse_cookie_options_array(
55 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56*/
57
48#if PHP_VERSION_ID >= 70300 58#if PHP_VERSION_ID >= 70300
49static void php_head_parse_cookie_options_array( 59static void php_head_parse_cookie_options_array(
50 zval *options, zend_long *expires, zend_string **path, zend_string **domain, 60 zval *options, zend_long *expires, zend_string **path, zend_string **domain,
51 zend_bool *secure, zend_bool *httponly, zend_string **samesite) { 61 zend_bool *secure, zend_bool *httponly, zend_string **samesite
62#if PHP_VERSION_ID >= 80500
63 ,bool *partitioned
64#endif
65 ) {
52 int found = 0; 66 int found = 0;
53 zend_string *key; 67 zend_string *key;
54 zval *value; 68 zval *value;
@@ -73,6 +87,11 @@ static void php_head_parse_cookie_options_array(
73 } else if (zend_string_equals_literal_ci(key, "samesite")) { 87 } else if (zend_string_equals_literal_ci(key, "samesite")) {
74 *samesite = zval_get_string(value); 88 *samesite = zval_get_string(value);
75 found++; 89 found++;
90#if PHP_VERSION_ID >= 80500
91 } else if (zend_string_equals_literal_ci(key, "partitioned")) {
92 *partitioned = zval_is_true(value);
93 found++;
94#endif
76 } else { 95 } else {
77 php_error_docref(NULL, E_WARNING, 96 php_error_docref(NULL, E_WARNING,
78 "Unrecognized key '%s' found in the options array", 97 "Unrecognized key '%s' found in the options array",
@@ -94,6 +113,9 @@ static void php_head_parse_cookie_options_array(
94#endif 113#endif
95 114
96PHP_FUNCTION(sp_setcookie) { 115PHP_FUNCTION(sp_setcookie) {
116#if PHP_VERSION_ID >= 80500
117 zend_bool partitioned;
118#endif
97 zend_string *name = NULL, *value = NULL, *path = NULL, *domain = NULL, 119 zend_string *name = NULL, *value = NULL, *path = NULL, *domain = NULL,
98 *value_enc = NULL, 120 *value_enc = NULL,
99#if PHP_VERSION_ID < 70300 121#if PHP_VERSION_ID < 70300
@@ -133,7 +155,11 @@ PHP_FUNCTION(sp_setcookie) {
133 } 155 }
134 php_head_parse_cookie_options_array(expires_or_options, &expires, &path, 156 php_head_parse_cookie_options_array(expires_or_options, &expires, &path,
135 &domain, &secure, &httponly, 157 &domain, &secure, &httponly,
158#if PHP_VERSION_ID < 80500
136 &samesite); 159 &samesite);
160#else
161 &samesite, &partitioned);
162#endif
137 } else { 163 } else {
138 expires = zval_get_long(expires_or_options); 164 expires = zval_get_long(expires_or_options);
139 } 165 }
@@ -194,9 +220,12 @@ PHP_FUNCTION(sp_setcookie) {
194 if (php_setcookie(name, (value_enc ? value_enc : value), expires, 220 if (php_setcookie(name, (value_enc ? value_enc : value), expires,
195 (path_samesite ? path_samesite : path), domain, secure, 1, 221 (path_samesite ? path_samesite : path), domain, secure, 1,
196 httponly) == SUCCESS) { 222 httponly) == SUCCESS) {
197#else 223#elif PHP_VERSION_ID < 80500
198 if (php_setcookie(name, (value_enc ? value_enc : value), expires, path, 224 if (php_setcookie(name, (value_enc ? value_enc : value), expires, path,
199 domain, secure, httponly, samesite, 1) == SUCCESS) { 225 domain, secure, httponly, samesite, 1) == SUCCESS) {
226#else
227 if (php_setcookie(name, (value_enc ? value_enc : value), expires, path,
228 domain, secure, httponly, samesite, partitioned, false) == SUCCESS) {
200#endif 229#endif
201 RETVAL_TRUE; 230 RETVAL_TRUE;
202 } else { 231 } else {