summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/builds.yml1
-rw-r--r--src/sp_cookie_encryption.c23
-rw-r--r--src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt1
-rw-r--r--src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt1
-rw-r--r--src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt1
5 files changed, 25 insertions, 2 deletions
diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml
index e46b1bc..81122a1 100644
--- a/.github/workflows/builds.yml
+++ b/.github/workflows/builds.yml
@@ -11,6 +11,7 @@ jobs:
11 strategy: 11 strategy:
12 matrix: 12 matrix:
13 container: 13 container:
14 - php:8.5.0beta2
14 - php:8.4 15 - php:8.4
15 - php:8.3 16 - php:8.3
16 - php:8.2 17 - php:8.2
diff --git a/src/sp_cookie_encryption.c b/src/sp_cookie_encryption.c
index c833f94..ec5c7c2 100644
--- a/src/sp_cookie_encryption.c
+++ b/src/sp_cookie_encryption.c
@@ -48,7 +48,11 @@ static zend_string *encrypt_data(zend_string *data) {
48#if PHP_VERSION_ID >= 70300 48#if PHP_VERSION_ID >= 70300
49static void php_head_parse_cookie_options_array( 49static void php_head_parse_cookie_options_array(
50 zval *options, zend_long *expires, zend_string **path, zend_string **domain, 50 zval *options, zend_long *expires, zend_string **path, zend_string **domain,
51 zend_bool *secure, zend_bool *httponly, zend_string **samesite) { 51 zend_bool *secure, zend_bool *httponly, zend_string **samesite
52#if PHP_VERSION_ID >= 80500
53 ,bool *partitioned
54#endif
55 ) {
52 int found = 0; 56 int found = 0;
53 zend_string *key; 57 zend_string *key;
54 zval *value; 58 zval *value;
@@ -73,6 +77,11 @@ static void php_head_parse_cookie_options_array(
73 } else if (zend_string_equals_literal_ci(key, "samesite")) { 77 } else if (zend_string_equals_literal_ci(key, "samesite")) {
74 *samesite = zval_get_string(value); 78 *samesite = zval_get_string(value);
75 found++; 79 found++;
80#if PHP_VERSION_ID >= 80500
81 } else if (zend_string_equals_literal_ci(key, "partitioned")) {
82 *partitioned = zval_is_true(value);
83 found++;
84#endif
76 } else { 85 } else {
77 php_error_docref(NULL, E_WARNING, 86 php_error_docref(NULL, E_WARNING,
78 "Unrecognized key '%s' found in the options array", 87 "Unrecognized key '%s' found in the options array",
@@ -94,6 +103,9 @@ static void php_head_parse_cookie_options_array(
94#endif 103#endif
95 104
96PHP_FUNCTION(sp_setcookie) { 105PHP_FUNCTION(sp_setcookie) {
106#if PHP_VERSION_ID >= 80500
107 zend_bool partitioned;
108#endif
97 zend_string *name = NULL, *value = NULL, *path = NULL, *domain = NULL, 109 zend_string *name = NULL, *value = NULL, *path = NULL, *domain = NULL,
98 *value_enc = NULL, 110 *value_enc = NULL,
99#if PHP_VERSION_ID < 70300 111#if PHP_VERSION_ID < 70300
@@ -133,7 +145,11 @@ PHP_FUNCTION(sp_setcookie) {
133 } 145 }
134 php_head_parse_cookie_options_array(expires_or_options, &expires, &path, 146 php_head_parse_cookie_options_array(expires_or_options, &expires, &path,
135 &domain, &secure, &httponly, 147 &domain, &secure, &httponly,
148#if PHP_VERSION_ID < 80500
136 &samesite); 149 &samesite);
150#else
151 &samesite, &partitioned);
152#endif
137 } else { 153 } else {
138 expires = zval_get_long(expires_or_options); 154 expires = zval_get_long(expires_or_options);
139 } 155 }
@@ -194,9 +210,12 @@ PHP_FUNCTION(sp_setcookie) {
194 if (php_setcookie(name, (value_enc ? value_enc : value), expires, 210 if (php_setcookie(name, (value_enc ? value_enc : value), expires,
195 (path_samesite ? path_samesite : path), domain, secure, 1, 211 (path_samesite ? path_samesite : path), domain, secure, 1,
196 httponly) == SUCCESS) { 212 httponly) == SUCCESS) {
197#else 213#elif PHP_VERSION_ID < 80500
198 if (php_setcookie(name, (value_enc ? value_enc : value), expires, path, 214 if (php_setcookie(name, (value_enc ? value_enc : value), expires, path,
199 domain, secure, httponly, samesite, 1) == SUCCESS) { 215 domain, secure, httponly, samesite, 1) == SUCCESS) {
216#else
217 if (php_setcookie(name, (value_enc ? value_enc : value), expires, path,
218 domain, secure, httponly, samesite, partitioned, false) == SUCCESS) {
200#endif 219#endif
201 RETVAL_TRUE; 220 RETVAL_TRUE;
202 } else { 221 } else {
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt b/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt
index aeb64c2..6f53cea 100644
--- a/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt
+++ b/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt
@@ -4,6 +4,7 @@ Disable functions - shell_exec via backtick operator
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> 4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI-- 5--INI--
6sp.configuration_file={PWD}/config/disabled_functions_extra.ini 6sp.configuration_file={PWD}/config/disabled_functions_extra.ini
7error_reporting = E_ALL & ~E_DEPRECATED
7--FILE-- 8--FILE--
8<?php 9<?php
9echo `ls`; 10echo `ls`;
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt
index a312acf..6ea5865 100644
--- a/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt
+++ b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt
@@ -4,6 +4,7 @@ Disable functions - shell_exec via backtick operator in context of a var name
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> 4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI-- 5--INI--
6sp.configuration_file={PWD}/config/disabled_functions_extra.ini 6sp.configuration_file={PWD}/config/disabled_functions_extra.ini
7error_reporting = E_ALL & ~E_DEPRECATED
7--FILE-- 8--FILE--
8<?php 9<?php
9echo ${`ls`}; 10echo ${`ls`};
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt
index ea77a7d..f117568 100644
--- a/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt
+++ b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt
@@ -4,6 +4,7 @@ Disable functions - shell_exec via backtick operator in context of a var name in
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> 4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI-- 5--INI--
6sp.configuration_file={PWD}/config/disabled_functions_extra.ini 6sp.configuration_file={PWD}/config/disabled_functions_extra.ini
7error_reporting = E_ALL & ~E_DEPRECATED
7--FILE-- 8--FILE--
8<?php 9<?php
9echo "{${`ls`}}"; 10echo "{${`ls`}}";