Date: Tuesday, January 3, 2023 @ 20:21:12 Author: kpcyrd Revision: 1374965
upgpkg: php-snuffleupagus 0.9.0-1 Modified: php-snuffleupagus/trunk/PKGBUILD Deleted: php-snuffleupagus/trunk/php-8.2.patch ---------------+ PKGBUILD | 13 php-8.2.patch | 797 -------------------------------------------------------- 2 files changed, 5 insertions(+), 805 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2023-01-03 20:11:49 UTC (rev 1374964) +++ PKGBUILD 2023-01-03 20:21:12 UTC (rev 1374965) @@ -3,8 +3,8 @@ pkgname=php-snuffleupagus _pkgname=snuffleupagus -pkgver=0.8.3 -pkgrel=3 +pkgver=0.9.0 +pkgrel=1 pkgdesc="Security module for PHP" url='https://snuffleupagus.readthedocs.io/' arch=('x86_64') @@ -12,16 +12,13 @@ depends=('php') backup=('etc/php/conf.d/snuffleupagus.ini' 'etc/php/conf.d/snuffleupagus.rules') -source=(https://github.com/jvoisin/${_pkgname}/archive/v${pkgver}/${_pkgname}-${pkgver}.tar.gz - 'php-8.2.patch') -b2sums=('989dbb57a8375cb394dfb41f07de5c048b66936a8e5b3dd14fb3609149dd371203f7a30d1fbcfe8ef6faa2ba5864c68b209b1b209541c348c0277c8bd12b568a' - 'cc204f850f0d07fd98d550b49416596ebab2d1a10e383faedb6302f7530665c713dd64cbd6091ef8313e08603b744da46dcc07beac17faf48f897c124c67e74b') +source=(https://github.com/jvoisin/${_pkgname}/archive/v${pkgver}/${_pkgname}-${pkgver}.tar.gz) +sha256sums=('36c99dd9540444ab6c931c687255522dac6705275cdc291b4e25a1d416b7a42e') +b2sums=('c01246d7bc3cf248c2cdceb22a8b720ccaccf52498b3f02a20a2083190aadccb802a109a51509caae229b3625ff09174a173be3a996360b4576e87fefad3be21') prepare() { cd ${_pkgname}-${pkgver} - patch -p1 -i "$srcdir/php-8.2.patch" - # tests are incompatible with PHP 8.1 rm src/tests/{disable_function/disabled_functions_include_once,disable_function/disabled_functions_include_simulation,disable_function/disabled_functions_register_tick_function,disable_function/disabled_functions_require,disable_function/disabled_functions_require_once,disable_function/disabled_functions_require_simulation,strict_mode/strict_mode_enabled,stream_wrapper/stream_wrapper}.phpt Deleted: php-8.2.patch =================================================================== --- php-8.2.patch 2023-01-03 20:11:49 UTC (rev 1374964) +++ php-8.2.patch 2023-01-03 20:21:12 UTC (rev 1374965) @@ -1,797 +0,0 @@ -From 110daa81c3b11ec102daf4ee634e2f3d2e9c5f36 Mon Sep 17 00:00:00 2001 -From: jvoisin <[email protected]> -Date: Thu, 8 Dec 2022 21:08:38 +0100 -Subject: [PATCH] Portability improvements for PHP8.2 - ---- - src/sp_execute.c | 18 +++++++++++++++--- - src/sp_utils.c | 2 +- - .../dump_request/dump_eval_blacklist.phpt | 8 +++++--- - .../dump_request/dump_eval_whitelist.phpt | 8 +++++--- - src/tests/dump_request/dump_request.phpt | 8 +++++--- - .../dump_request/dump_request_stacktrace.phpt | 8 +++++--- - .../dump_request/dump_request_too_big.phpt | 8 +++++--- - 7 files changed, 41 insertions(+), 19 deletions(-) - -diff --git a/src/sp_execute.c b/src/sp_execute.c -index 5c0c9390..84f6275c 100644 ---- a/src/sp_execute.c -+++ b/src/sp_execute.c -@@ -336,7 +336,11 @@ static zend_result sp_stream_open(zend_file_handle *handle) { - - ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, - int type) = NULL; --#if PHP_VERSION_ID >= 80000 -+#if PHP_VERSION_ID >= 82000 -+ZEND_API zend_op_array* (*orig_zend_compile_string)( -+ zend_string* source_string, const char* filename, -+ enum _zend_compile_position position) = NULL; -+#elif PHP_VERSION_ID >= 80000 - ZEND_API zend_op_array* (*orig_zend_compile_string)( - zend_string* source_string, const char* filename) = NULL; - #else -@@ -344,7 +348,11 @@ ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, - char* filename) = NULL; - #endif - --#if PHP_VERSION_ID >= 80000 -+#if PHP_VERSION_ID >= 82000 -+ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, -+ const char* filename, -+ enum _zend_compile_position position) { -+#elif PHP_VERSION_ID >= 80000 - ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, - const char* filename) { - #else -@@ -352,7 +360,11 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { - #endif - // TODO(jvoisin) handle recursive calls to `eval` - SPG(eval_source_string) = source_string; -- zend_op_array* opline = orig_zend_compile_string(source_string, filename); -+ zend_op_array* opline = orig_zend_compile_string(source_string, filename -+#if PHP_VERSION_ID >= 82000 -+ , position -+#endif -+ ); - if (SPCFG(sloppy).enable) { - sp_sloppy_modify_opcode(opline); - } -diff --git a/src/sp_utils.c b/src/sp_utils.c -index 42f78712..3107f77e 100644 ---- a/src/sp_utils.c -+++ b/src/sp_utils.c -@@ -473,7 +473,7 @@ void unhook_functions(HashTable *ht) { - func->internal_function.handler = orig_handler; - } - (void)idx;//silence a -Wunused-but-set-variable -- ZEND_HASH_FOREACH_END_DEL(); -+ ZEND_HASH_FOREACH_END(); - } - - bool check_is_in_eval_whitelist(const char* function_name) { -diff --git a/src/tests/dump_request/dump_eval_blacklist.phpt b/src/tests/dump_request/dump_eval_blacklist.phpt -index a8c16181..e294703e 100644 ---- a/src/tests/dump_request/dump_eval_blacklist.phpt -+++ b/src/tests/dump_request/dump_eval_blacklist.phpt -@@ -6,10 +6,12 @@ if (!extension_loaded("snuffleupagus")) print "skip"; - ?> - --CLEAN-- - <?php --foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); - } --@rmdir("/tmp/dump_result/"); - ?> - --POST-- - post_a=data_post_a&post_b=data_post_b -diff --git a/src/tests/dump_request/dump_eval_whitelist.phpt b/src/tests/dump_request/dump_eval_whitelist.phpt -index cc5a824e..7385146d 100644 ---- a/src/tests/dump_request/dump_eval_whitelist.phpt -+++ b/src/tests/dump_request/dump_eval_whitelist.phpt -@@ -6,10 +6,12 @@ if (!extension_loaded("snuffleupagus")) print "skip"; - ?> - --CLEAN-- - <?php --foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); - } --@rmdir("/tmp/dump_result/"); - ?> - --POST-- - post_a=data_post_a&post_b=data_post_b -diff --git a/src/tests/dump_request/dump_request.phpt b/src/tests/dump_request/dump_request.phpt -index f8dee119..e9557767 100644 ---- a/src/tests/dump_request/dump_request.phpt -+++ b/src/tests/dump_request/dump_request.phpt -@@ -8,10 +8,12 @@ if (!extension_loaded("snuffleupagus")) { - ?> - --CLEAN-- - <?php --foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); - } --@rmdir("/tmp/dump_result/"); - ?> - --POST-- - post_a=data_post_a&post_b=data_post_b -diff --git a/src/tests/dump_request/dump_request_stacktrace.phpt b/src/tests/dump_request/dump_request_stacktrace.phpt -index 9b02ab5f..9f850445 100644 ---- a/src/tests/dump_request/dump_request_stacktrace.phpt -+++ b/src/tests/dump_request/dump_request_stacktrace.phpt -@@ -8,10 +8,12 @@ if (!extension_loaded("snuffleupagus")) { - ?> - --CLEAN-- - <?php --foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); - } --@rmdir("/tmp/dump_result/"); - ?> - --POST-- - post_a=data_post_a&post_b=data_post_b -diff --git a/src/tests/dump_request/dump_request_too_big.phpt b/src/tests/dump_request/dump_request_too_big.phpt -index fd265f27..4fc8f812 100644 ---- a/src/tests/dump_request/dump_request_too_big.phpt -+++ b/src/tests/dump_request/dump_request_too_big.phpt -@@ -8,10 +8,12 @@ if (!extension_loaded("snuffleupagus")) { - ?> - --CLEAN-- - <?php --foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); - } --@rmdir("/tmp/dump_result/"); - ?> - --POST-- - post_a=data_post_a&post_b=data_post_b&post_c=c -From c016fa1a7ce11e657f215dd69deac59d973d6dd9 Mon Sep 17 00:00:00 2001 -From: jvoisin <[email protected]> -Date: Sat, 10 Dec 2022 11:36:04 +0100 -Subject: [PATCH] Even more changes to accomodate PHP8.2 - ---- - src/sp_execute.c | 6 +++--- - src/sp_ini.c | 6 ++++++ - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/src/sp_execute.c b/src/sp_execute.c -index 84f6275c..300d05c8 100644 ---- a/src/sp_execute.c -+++ b/src/sp_execute.c -@@ -336,7 +336,7 @@ static zend_result sp_stream_open(zend_file_handle *handle) { - - ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, - int type) = NULL; --#if PHP_VERSION_ID >= 82000 -+#if PHP_VERSION_ID >= 80200 - ZEND_API zend_op_array* (*orig_zend_compile_string)( - zend_string* source_string, const char* filename, - enum _zend_compile_position position) = NULL; -@@ -348,7 +348,7 @@ ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, - char* filename) = NULL; - #endif - --#if PHP_VERSION_ID >= 82000 -+#if PHP_VERSION_ID >= 80200 - ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, - const char* filename, - enum _zend_compile_position position) { -@@ -361,7 +361,7 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { - // TODO(jvoisin) handle recursive calls to `eval` - SPG(eval_source_string) = source_string; - zend_op_array* opline = orig_zend_compile_string(source_string, filename --#if PHP_VERSION_ID >= 82000 -+#if PHP_VERSION_ID >= 80200 - , position - #endif - ); -diff --git a/src/sp_ini.c b/src/sp_ini.c -index ed23fb75..7b22012a 100644 ---- a/src/sp_ini.c -+++ b/src/sp_ini.c -@@ -57,9 +57,15 @@ static bool /* success */ sp_ini_check(zend_string *const restrict varname, zend - // we have a new_value. - - if (entry->min || entry->max) { -+#if PHP_VERSION_ID >= 80200 -+ zend_long lvalue = ZEND_STRTOL(ZSTR_VAL(new_value), NULL, 0); -+ if ((entry->min && ZEND_STRTOL(ZSTR_VAL(entry->min), NULL, 0) > lvalue) || -+ (entry->max && ZEND_STRTOL(ZSTR_VAL(entry->max), NULL, 0) < lvalue)) { -+#else - zend_long lvalue = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); - if ((entry->min && zend_atol(ZSTR_VAL(entry->min), ZSTR_LEN(entry->min)) > lvalue) || - (entry->max && zend_atol(ZSTR_VAL(entry->max), ZSTR_LEN(entry->max)) < lvalue)) { -+#endif - sp_log_ini_check_violation("%s", (entry->msg ? ZSTR_VAL(entry->msg) : "INI value out of range")); - return simulation; - } -From eb570f29daa42fd8b90ecfff75382846e51b3a15 Mon Sep 17 00:00:00 2001 -From: jvoisin <[email protected]> -Date: Sat, 10 Dec 2022 12:00:36 +0100 -Subject: [PATCH] Add support for PHP8.2 - ---- - .github/workflows/builds.yml | 1 + - .../deny_writable_execution_disabled.phpt | 12 ++++---- - ...bled_functions_callback_called_file_r.phpt | 5 ---- - .../disabled_functions_called_file_r.phpt | 5 ---- - .../disabled_functions_include_once.phpt | 13 ++++----- - ...disabled_functions_include_simulation.phpt | 13 ++++----- - .../disabled_functions_require.phpt | 13 ++++----- - .../disabled_functions_require_allow.phpt | 11 ++++---- - .../disabled_functions_require_once.phpt | 12 ++++---- - ...disabled_functions_require_simulation.phpt | 12 ++++---- - .../disabled_functions_runtime.phpt | 11 ++++---- - .../dump_request/dump_eval_blacklist.phpt | 9 ------ - .../dump_request/dump_eval_whitelist.phpt | 9 ------ - src/tests/dump_request/dump_request.phpt | 16 +++++------ - .../dump_request/dump_request_stacktrace.phpt | 9 ------ - .../dump_request/dump_request_too_big.phpt | 15 ++++------ - .../eval_whitelist_include_then_user.phpt | 10 +++---- - .../stream_wrapper_register.phpt | 1 + - .../stream_wrapper_register_php82.phpt | 28 +++++++++++++++++++ - .../xxe/disable_xxe_dom_disabled_php8.phpt | 10 +++---- - src/tests/xxe/disable_xxe_dom_php8.phpt | 13 ++++----- - 21 files changed, 100 insertions(+), 128 deletions(-) - create mode 100644 src/tests/stream_wrapper/stream_wrapper_register_php82.phpt - -diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml -index 7a7c9b67..a1206ead 100644 ---- a/.github/workflows/builds.yml -+++ b/.github/workflows/builds.yml -@@ -11,6 +11,7 @@ jobs: - strategy: - matrix: - container: -+ - php:8.2 - - php:8.1 - - php:8.0 - - php:7.4 -diff --git a/src/tests/deny_writable/deny_writable_execution_disabled.phpt b/src/tests/deny_writable/deny_writable_execution_disabled.phpt -index dd01f010..0fd19f4e 100644 ---- a/src/tests/deny_writable/deny_writable_execution_disabled.phpt -+++ b/src/tests/deny_writable/deny_writable_execution_disabled.phpt -@@ -18,15 +18,13 @@ chmod("$dir/writable_file.txt", 0777); - chmod("$dir/non_writable_file.txt", 0400); - include "$dir/writable_file.txt"; - include "$dir/non_writable_file.txt"; --?> ----EXPECT-- --Code execution within a writable file. --Code execution within a non-writable file. ----CLEAN-- --<?php --$dir = __DIR__; -+ -+// Clean up - chmod("$dir/non_writable_file.txt", 0777); - chmod("$dir/writable_file.txt", 0777); - unlink("$dir/non_writable_file.txt"); - unlink("$dir/writable_file.txt"); - ?> -+--EXPECT-- -+Code execution within a writable file. -+Code execution within a non-writable file. -diff --git a/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt b/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt -index ec75d740..d9777332 100644 ---- a/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt -+++ b/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt -@@ -29,11 +29,6 @@ include "$dir/myfunc_callback.php"; - - echo test('test_callback'); - --?> ----CLEAN-- --<?php --$dir = __DIR__; --@unlink("$dir/myfunc_callback.php"); - ?> - --EXPECTF-- - Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test_callback' in %a/myfunc_callback.php on line 4 -diff --git a/src/tests/disable_function/disabled_functions_called_file_r.phpt b/src/tests/disable_function/disabled_functions_called_file_r.phpt -index dde26f7c..2ba06d40 100644 ---- a/src/tests/disable_function/disabled_functions_called_file_r.phpt -+++ b/src/tests/disable_function/disabled_functions_called_file_r.phpt -@@ -24,11 +24,6 @@ include "$dir/myfunc.php"; - - test(); - --?> ----CLEAN-- --<?php --$dir = __DIR__; --@unlink("$dir/myfunc.php"); - ?> - --EXPECTF-- - Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test' in %a/myfunc.php on line 3 -diff --git a/src/tests/disable_function/disabled_functions_include_once.phpt b/src/tests/disable_function/disabled_functions_include_once.phpt -index 57cb5a1d..8b1bec8c 100644 ---- a/src/tests/disable_function/disabled_functions_include_once.phpt -+++ b/src/tests/disable_function/disabled_functions_include_once.phpt -@@ -7,21 +7,20 @@ sp.configuration_file={PWD}/config/config_disabled_functions_include.ini - --FILE-- - <?php - $dir = __DIR__; -+ -+// Just inc ase -+@unlink($dir . '/test.bla'); -+@unlink($dir . '/test.sim'); -+ - file_put_contents($dir . '/test.bla', "BLA\n"); - file_put_contents($dir . '/test.sim', "MEH\n"); - include_once $dir . '/test.bla'; - include_once $dir . '/test.sim'; - echo "1337\n"; - ?> ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --unlink($dir . '/test.sim'); --?> - --EXPECTF-- - BLA - --Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include_once', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_once.php on line 6 -+Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include_once', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_once.php on line %d - MEH - 1337 -diff --git a/src/tests/disable_function/disabled_functions_include_simulation.phpt b/src/tests/disable_function/disabled_functions_include_simulation.phpt -index 53ea2a4a..cf2c6937 100644 ---- a/src/tests/disable_function/disabled_functions_include_simulation.phpt -+++ b/src/tests/disable_function/disabled_functions_include_simulation.phpt -@@ -7,21 +7,20 @@ sp.configuration_file={PWD}/config/config_disabled_functions_include.ini - --FILE-- - <?php - $dir = __DIR__; -+ -+// Just in case -+@unlink($dir . '/test.bla'); -+@unlink($dir . '/test.sim'); -+ - file_put_contents($dir . '/test.bla', "BLA\n"); - file_put_contents($dir . '/test.sim', "MEH\n"); - include $dir . '/test.bla'; - include $dir . '/test.sim'; - echo "1337\n"; - ?> ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --unlink($dir . '/test.sim'); --?> - --EXPECTF-- - BLA - --Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_simulation.php on line 6 -+Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_simulation.php on line %d - MEH - 1337 -diff --git a/src/tests/disable_function/disabled_functions_require.phpt b/src/tests/disable_function/disabled_functions_require.phpt -index df2b2f02..bf59b58b 100644 ---- a/src/tests/disable_function/disabled_functions_require.phpt -+++ b/src/tests/disable_function/disabled_functions_require.phpt -@@ -7,18 +7,17 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require.ini - --FILE-- - <?php - $dir = __DIR__; -+ -+// Just in case -+@unlink($dir . '/test.bla'); -+@unlink($dir . '/test.meh'); -+ - file_put_contents($dir . '/test.bla', "BLA"); - file_put_contents($dir . '/test.meh', "MEH"); - require $dir . '/test.bla'; - require $dir . '/test.meh'; - echo "1337"; - ?> ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --unlink($dir . '/test.meh'); --?> - --EXPECTF-- - BLA --Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require.php on line 6 -+Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require.php on line %d -diff --git a/src/tests/disable_function/disabled_functions_require_allow.phpt b/src/tests/disable_function/disabled_functions_require_allow.phpt -index 7ab29aa5..37a7e33a 100644 ---- a/src/tests/disable_function/disabled_functions_require_allow.phpt -+++ b/src/tests/disable_function/disabled_functions_require_allow.phpt -@@ -7,6 +7,11 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require_allow.ini - --FILE-- - <?php - $dir = __DIR__; -+ -+// Just in case -+unlink($dir . '/test.bla'); -+unlink($dir . '/test.meh'); -+ - file_put_contents($dir . '/test.bla', "BLA\n"); - file_put_contents($dir . '/test.meh', "MEH\n"); - require $dir . '/test.bla'; -@@ -17,9 +22,3 @@ echo "1337"; - BLA - MEH - 1337 ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --unlink($dir . '/test.meh'); --?> -diff --git a/src/tests/disable_function/disabled_functions_require_once.phpt b/src/tests/disable_function/disabled_functions_require_once.phpt -index 7356c086..81049efe 100644 ---- a/src/tests/disable_function/disabled_functions_require_once.phpt -+++ b/src/tests/disable_function/disabled_functions_require_once.phpt -@@ -7,18 +7,16 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require.ini - --FILE-- - <?php - $dir = __DIR__; -+// Just in case -+unlink($dir . '/test.bla'); -+unlink($dir . '/test.meh'); -+ - file_put_contents($dir . '/test.bla', "BLA"); - file_put_contents($dir . '/test.meh', "MEH"); - require_once $dir . '/test.bla'; - require_once $dir . '/test.meh'; - echo "1337"; - ?> ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --unlink($dir . '/test.meh'); --?> - --EXPECTF-- - BLA --Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require_once', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require_once.php on line 6 -+Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require_once', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require_once.php on line %d -diff --git a/src/tests/disable_function/disabled_functions_require_simulation.phpt b/src/tests/disable_function/disabled_functions_require_simulation.phpt -index fa1523c7..2c52610f 100644 ---- a/src/tests/disable_function/disabled_functions_require_simulation.phpt -+++ b/src/tests/disable_function/disabled_functions_require_simulation.phpt -@@ -7,21 +7,19 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require.ini - --FILE-- - <?php - $dir = __DIR__; -+// Just in case -+@unlink($dir . '/test.bla'); -+@unlink($dir . '/test.sim'); -+ - file_put_contents($dir . '/test.bla', "BLA\n"); - file_put_contents($dir . '/test.sim', "MEH\n"); - require $dir . '/test.bla'; - require $dir . '/test.sim'; - echo "1337\n"; - ?> ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --unlink($dir . '/test.sim'); --?> - --EXPECTF-- - BLA - --Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_require_simulation.php on line 6 -+Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_require_simulation.php on line %d - MEH - 1337 -diff --git a/src/tests/disable_function/disabled_functions_runtime.phpt b/src/tests/disable_function/disabled_functions_runtime.phpt -index 16ecfdb3..8175a778 100644 ---- a/src/tests/disable_function/disabled_functions_runtime.phpt -+++ b/src/tests/disable_function/disabled_functions_runtime.phpt -@@ -6,8 +6,12 @@ Disable functions - runtime inclusion - sp.configuration_file={PWD}/config/config_disabled_functions_param_runtime.ini - --FILE-- - <?php -- - $dir = __DIR__; -+ -+// Just in case -+@unlink("file_to_include1.php"); -+@unlink("file_to_include2.php"); -+ - $content = '<?php function test($param) { echo $param . "\n"; }'; - file_put_contents('file_to_include1.php', $content); - file_put_contents('file_to_include2.php', $content); -@@ -20,11 +24,6 @@ if (rand() % 2) { - - test('1338');test('1337'); - --?> ----CLEAN-- --<?php --unlink("file_to_include1.php"); --unlink("file_to_include2.php"); - ?> - --EXPECTF-- - 1338 -diff --git a/src/tests/dump_request/dump_eval_blacklist.phpt b/src/tests/dump_request/dump_eval_blacklist.phpt -index e294703e..ae6ffc0d 100644 ---- a/src/tests/dump_request/dump_eval_blacklist.phpt -+++ b/src/tests/dump_request/dump_eval_blacklist.phpt -@@ -4,15 +4,6 @@ Dump eval blacklist - <?php - if (!extension_loaded("snuffleupagus")) print "skip"; - ?> ----CLEAN-- --<?php --if (is_dir("/tmp/dump_result/")) { -- foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -- } -- @rmdir("/tmp/dump_result/"); --} --?> - --POST-- - post_a=data_post_a&post_b=data_post_b - --GET-- -diff --git a/src/tests/dump_request/dump_eval_whitelist.phpt b/src/tests/dump_request/dump_eval_whitelist.phpt -index 7385146d..09f55235 100644 ---- a/src/tests/dump_request/dump_eval_whitelist.phpt -+++ b/src/tests/dump_request/dump_eval_whitelist.phpt -@@ -4,15 +4,6 @@ Dump eval whitelist - <?php - if (!extension_loaded("snuffleupagus")) print "skip"; - ?> ----CLEAN-- --<?php --if (is_dir("/tmp/dump_result/")) { -- foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -- } -- @rmdir("/tmp/dump_result/"); --} --?> - --POST-- - post_a=data_post_a&post_b=data_post_b - --GET-- -diff --git a/src/tests/dump_request/dump_request.phpt b/src/tests/dump_request/dump_request.phpt -index e9557767..7ad03235 100644 ---- a/src/tests/dump_request/dump_request.phpt -+++ b/src/tests/dump_request/dump_request.phpt -@@ -6,15 +6,6 @@ if (!extension_loaded("snuffleupagus")) { - print "skip"; - } - ?> ----CLEAN-- --<?php --if (is_dir("/tmp/dump_result/")) { -- foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -- } -- @rmdir("/tmp/dump_result/"); --} --?> - --POST-- - post_a=data_post_a&post_b=data_post_b - --GET-- -@@ -25,6 +16,13 @@ cookie_a=data_cookie_a&cookie_b=data_cookie_b - sp.configuration_file={PWD}/config/dump_request.ini - --FILE-- - <?php -+// Just in case -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); -+} - echo "1\n"; - system("echo 1337;"); - $filename = glob('/tmp/dump_result/sp_dump.*')[0]; -diff --git a/src/tests/dump_request/dump_request_stacktrace.phpt b/src/tests/dump_request/dump_request_stacktrace.phpt -index 9f850445..765e912c 100644 ---- a/src/tests/dump_request/dump_request_stacktrace.phpt -+++ b/src/tests/dump_request/dump_request_stacktrace.phpt -@@ -6,15 +6,6 @@ if (!extension_loaded("snuffleupagus")) { - print "skip"; - } - ?> ----CLEAN-- --<?php --if (is_dir("/tmp/dump_result/")) { -- foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -- } -- @rmdir("/tmp/dump_result/"); --} --?> - --POST-- - post_a=data_post_a&post_b=data_post_b - --GET-- -diff --git a/src/tests/dump_request/dump_request_too_big.phpt b/src/tests/dump_request/dump_request_too_big.phpt -index 4fc8f812..b143bd02 100644 ---- a/src/tests/dump_request/dump_request_too_big.phpt -+++ b/src/tests/dump_request/dump_request_too_big.phpt -@@ -6,15 +6,6 @@ if (!extension_loaded("snuffleupagus")) { - print "skip"; - } - ?> ----CLEAN-- --<?php --if (is_dir("/tmp/dump_result/")) { -- foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -- @unlink($dump); -- } -- @rmdir("/tmp/dump_result/"); --} --?> - --POST-- - post_a=data_post_a&post_b=data_post_b&post_c=c - --GET-- -@@ -29,6 +20,12 @@ END; - sp.configuration_file={PWD}/config/dump_request.ini - --FILE-- - <?php -+if (is_dir("/tmp/dump_result/")) { -+ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { -+ @unlink($dump); -+ } -+ @rmdir("/tmp/dump_result/"); -+} - echo "1\n"; - system("echo 1337;"); - $filename = glob('/tmp/dump_result/*')[0]; -diff --git a/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt b/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt -index 825480fa..e456ff98 100644 ---- a/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt -+++ b/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt -@@ -9,6 +9,9 @@ sp.configuration_file={PWD}/config/eval_whitelist.ini - $b = 1337; - $dir = __DIR__; - -+// Just in case -+@unlink($dir . '/test.bla'); -+ - file_put_contents($dir . '/test.bla', '<?php $b = sin(1) ?>'); - - $a = cos(1); -@@ -18,13 +21,8 @@ echo "After allowed eval: $a\n"; - eval("include_once('$dir' . '/test.bla');"); - echo "After eval: $b\n"; - ?> ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . '/test.bla'); --?> - --EXPECTF-- - Outside of eval: 0.54030230586814 - After allowed eval: 0.28366218546323 - --Fatal error: [snuffleupagus][0.0.0.0][Eval_whitelist][drop] The function 'sin' isn't in the eval whitelist, dropping its call. in %a/test.bla on line 1 -\ No newline at end of file -+Fatal error: [snuffleupagus][0.0.0.0][Eval_whitelist][drop] The function 'sin' isn't in the eval whitelist, dropping its call. in %a/test.bla on line 1 -diff --git a/src/tests/stream_wrapper/stream_wrapper_register.phpt b/src/tests/stream_wrapper/stream_wrapper_register.phpt -index 27d8afb2..4fa9ea8a 100644 ---- a/src/tests/stream_wrapper/stream_wrapper_register.phpt -+++ b/src/tests/stream_wrapper/stream_wrapper_register.phpt -@@ -2,6 +2,7 @@ - Stream wrapper - --SKIPIF-- - <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> -+<?php if (PHP_VERSION_ID >= 80200) print "skip"; ?> - --INI-- - sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini - --FILE-- -diff --git a/src/tests/stream_wrapper/stream_wrapper_register_php82.phpt b/src/tests/stream_wrapper/stream_wrapper_register_php82.phpt -new file mode 100644 -index 00000000..b03a2f19 ---- /dev/null -+++ b/src/tests/stream_wrapper/stream_wrapper_register_php82.phpt -@@ -0,0 +1,28 @@ -+--TEST-- -+Stream wrapper on PHP8.2+ -+--SKIPIF-- -+<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> -+<?php if (PHP_VERSION_ID < 80200) print "skip"; ?> -+--INI-- -+sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini -+--FILE-- -+<?php -+class qwe { -+ function stream_open($fname) { -+ return $fname; -+ } -+} -+ -+stream_wrapper_register("lelel", "qwe"); -+stream_wrapper_register("lolol", "qwe"); -+fopen("lelel://asdasd", "r"); -+fopen("lolol://asdasd", "r"); -+?> -+--EXPECTF-- -+Deprecated: Creation of dynamic property qwe::$context is deprecated in %s/tests/stream_wrapper/stream_wrapper_register_php82.php on line %d -+ -+Warning: fopen(): Unable to find the wrapper "lolol" - did you forget to enable it when you configured PHP? in %a/stream_wrapper_register_php82.php on line %d -+ -+Warning: fopen(): file:// wrapper is disabled in the server configuration in %a/stream_wrapper_register_php82.php on line %d -+ -+Warning: fopen(lolol://asdasd): %s to open stream: no suitable wrapper could be found in %a/stream_wrapper_register_php82.php on line %d -diff --git a/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt b/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt -index 01e33494..a78fe2dd 100644 ---- a/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt -+++ b/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt -@@ -10,6 +10,10 @@ dom - --FILE-- - <?php - $dir = __DIR__; -+// Just in case -+@unlink($dir . "/content.xml"); -+@unlink($dir . "/content.txt"); -+ - $content = '<content>WARNING, external entity loaded!</content>'; - file_put_contents($dir . '/content.txt', $content); - -@@ -49,9 +53,3 @@ default setting with LIBXML_NOENT: WARNING, external entity loaded! - default setting without LIBXML_NOENT: - disabled entity loader with LIBXML_NOENT: WARNING, external entity loaded! - disabled entity loader without LIBXML_NOENT: ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . "/content.xml"); --unlink($dir . "/content.txt"); --?> -diff --git a/src/tests/xxe/disable_xxe_dom_php8.phpt b/src/tests/xxe/disable_xxe_dom_php8.phpt -index 485828fb..133f87ef 100644 ---- a/src/tests/xxe/disable_xxe_dom_php8.phpt -+++ b/src/tests/xxe/disable_xxe_dom_php8.phpt -@@ -10,6 +10,11 @@ dom - --FILE-- - <?php - $dir = __DIR__; -+ -+// Just in case -+@unlink($dir . "/content.xml"); -+@unlink($dir . "/content.txt"); -+ - $content = '<content>WARNING, external entity loaded!</content>'; - file_put_contents($dir . '/content.txt', $content); - -@@ -48,12 +53,6 @@ printf("disabled entity loader without LIBXML_NOENT: %s\n", $dom->getElementsByT - default setting with LIBXML_NOENT: WARNING, external entity loaded! - default setting without LIBXML_NOENT: - --Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_set_external_entity_loader was tried and nopped in %a.php on line 26 -+Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_set_external_entity_loader was tried and nopped in %a.php on line %d - disabled entity loader with LIBXML_NOENT: WARNING, external entity loaded! - disabled entity loader without LIBXML_NOENT: ----CLEAN-- --<?php --$dir = __DIR__; --unlink($dir . "/content.xml"); --unlink($dir . "/content.txt"); --?>
