From d03c3c8d01f6f507bf844fec07477f30e3db61d9 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 23 Feb 2019 12:06:51 +0100 Subject: Fix the testsuite on php8. In php8, it's non-trivial to hook strlen, since this function is usually optimized away by the compiler. --- .../config/disabled_function_local_var.ini | 18 +++++++++--------- .../config/disabled_function_local_var_2.ini | 2 +- .../config/disabled_function_local_var_const.ini | 2 +- .../config/disabled_function_local_var_obj.ini | 6 +++--- .../config/disabled_function_super_global_var.ini | 2 +- .../disable_function/config/disabled_functions_mb.ini | 2 +- .../disable_function/config/disabled_functions_pos.ini | 2 +- .../config/disabled_functions_ret_type_long.ini | 2 +- .../disable_function/disabled_function_local_var.phpt | 6 +++--- .../disabled_function_local_var_10.phpt | 6 +++--- .../disabled_function_local_var_2.phpt | 8 ++++---- .../disabled_function_local_var_3.phpt | 6 +++--- .../disabled_function_local_var_4.phpt | 4 ++-- .../disabled_function_local_var_5.phpt | 6 +++--- .../disabled_function_local_var_6.phpt | 4 ++-- .../disabled_function_local_var_7.phpt | 4 ++-- .../disabled_function_local_var_8.phpt | 4 ++-- .../disabled_function_local_var_9.phpt | 4 ++-- .../disabled_function_local_var_const.phpt | 4 ++-- .../disabled_function_local_var_crash.phpt | 4 ++-- .../disabled_function_local_var_obj.phpt | 8 ++++---- .../disabled_function_super_global_var.phpt | 6 +++--- src/tests/disable_function/disabled_functions_mb.phpt | 4 ++-- .../disabled_functions_param_pos2.phpt | 6 +++--- .../disabled_functions_regexp_multiple.phpt | 8 ++++---- .../disabled_functions_ret_type_long.phpt | 4 ++-- 26 files changed, 66 insertions(+), 66 deletions(-) (limited to 'src/tests/disable_function') diff --git a/src/tests/disable_function/config/disabled_function_local_var.ini b/src/tests/disable_function/config/disabled_function_local_var.ini index 3d553c0..81b6771 100644 --- a/src/tests/disable_function/config/disabled_function_local_var.ini +++ b/src/tests/disable_function/config/disabled_function_local_var.ini @@ -1,10 +1,10 @@ sp.disable_function.function("phpinfo").var("$b").value("1337").drop(); -sp.disable_function.function("strlen").var("$a").value("1337").drop(); -sp.disable_function.function("strlen").var("$a['123']").value("block").drop(); -sp.disable_function.function("strlen").var("$a[$c]->prop").value("block").drop(); -sp.disable_function.function("strlen").var("$a->zxc").value("not a good value").drop(); -sp.disable_function.function("strlen").var("\\asd\\test_object::TEST_VALUE['constant']").value("no good").drop(); -sp.disable_function.function("strlen").var("\\asd\\test_object::TEST_VALUE").value("qwerty").drop(); -sp.disable_function.function("strlen").var("\\qwe\\ASD").value("qwerty").drop(); -sp.disable_function.function("strlen").var("\\qwe\\QWE['123']").value("asdfgh").drop(); -sp.disable_function.function("strlen").var("$qwe").value("block this").drop(); +sp.disable_function.function("strtoupper").var("$a").value("1337").drop(); +sp.disable_function.function("strtoupper").var("$a['123']").value("block").drop(); +sp.disable_function.function("strtoupper").var("$a[$c]->prop").value("block").drop(); +sp.disable_function.function("strtoupper").var("$a->zxc").value("not a good value").drop(); +sp.disable_function.function("strtoupper").var("\\asd\\test_object::TEST_VALUE['constant']").value("no good").drop(); +sp.disable_function.function("strtoupper").var("\\asd\\test_object::TEST_VALUE").value("qwerty").drop(); +sp.disable_function.function("strtoupper").var("\\qwe\\ASD").value("qwerty").drop(); +sp.disable_function.function("strtoupper").var("\\qwe\\QWE['123']").value("asdfgh").drop(); +sp.disable_function.function("strtoupper").var("$qwe").value("block this").drop(); diff --git a/src/tests/disable_function/config/disabled_function_local_var_2.ini b/src/tests/disable_function/config/disabled_function_local_var_2.ini index 6c0ae66..34dd8d1 100644 --- a/src/tests/disable_function/config/disabled_function_local_var_2.ini +++ b/src/tests/disable_function/config/disabled_function_local_var_2.ini @@ -1 +1 @@ -sp.disable_function.function("strlen").var("$b['_GET][\"obj->nop::qwe'][$b[456][$d->$idk->qwe[\\qwe\\UNE_CONSTANTE]]][$a]->uio").value("valeur de apres").drop(); +sp.disable_function.function("strtoupper").var("$b['_GET][\"obj->nop::qwe'][$b[456][$d->$idk->qwe[\\qwe\\UNE_CONSTANTE]]][$a]->uio").value("valeur de apres").drop(); diff --git a/src/tests/disable_function/config/disabled_function_local_var_const.ini b/src/tests/disable_function/config/disabled_function_local_var_const.ini index 8450de5..884750d 100644 --- a/src/tests/disable_function/config/disabled_function_local_var_const.ini +++ b/src/tests/disable_function/config/disabled_function_local_var_const.ini @@ -1 +1 @@ -sp.disable_function.function("strlen").var("MY_CONST").value("1337").drop(); +sp.disable_function.function("strtoupper").var("MY_CONST").value("1337").drop(); diff --git a/src/tests/disable_function/config/disabled_function_local_var_obj.ini b/src/tests/disable_function/config/disabled_function_local_var_obj.ini index df6b617..65c4a11 100644 --- a/src/tests/disable_function/config/disabled_function_local_var_obj.ini +++ b/src/tests/disable_function/config/disabled_function_local_var_obj.ini @@ -1,3 +1,3 @@ -sp.disable_function.function("strlen").var("$test->$test_array").value("value").drop(); -sp.disable_function.function("strlen").var("$arg->$test_array").value("value").drop(); -sp.disable_function.function("strlen").var("$test->$arg").value("nop_object").drop(); +sp.disable_function.function("strtoupper").var("$test->$test_array").value("value").drop(); +sp.disable_function.function("strtoupper").var("$arg->$test_array").value("value").drop(); +sp.disable_function.function("strtoupper").var("$test->$arg").value("nop_object").drop(); diff --git a/src/tests/disable_function/config/disabled_function_super_global_var.ini b/src/tests/disable_function/config/disabled_function_super_global_var.ini index 178a01a..5bb2d04 100644 --- a/src/tests/disable_function/config/disabled_function_super_global_var.ini +++ b/src/tests/disable_function/config/disabled_function_super_global_var.ini @@ -1 +1 @@ -sp.disable_function.function("strlen").var("$_GET[bla]").value("test2").drop(); +sp.disable_function.function("strtoupper").var("$_GET[bla]").value("test2").drop(); diff --git a/src/tests/disable_function/config/disabled_functions_mb.ini b/src/tests/disable_function/config/disabled_functions_mb.ini index 36eae40..f365063 100644 --- a/src/tests/disable_function/config/disabled_functions_mb.ini +++ b/src/tests/disable_function/config/disabled_functions_mb.ini @@ -1,2 +1,2 @@ -sp.disable_function.function("strlen").drop(); +sp.disable_function.function("strtoupper").drop(); sp.disable_function.function("mb_strlen").drop(); diff --git a/src/tests/disable_function/config/disabled_functions_pos.ini b/src/tests/disable_function/config/disabled_functions_pos.ini index 7f7c04d..f4c1e05 100644 --- a/src/tests/disable_function/config/disabled_functions_pos.ini +++ b/src/tests/disable_function/config/disabled_functions_pos.ini @@ -1,4 +1,4 @@ sp.disable_function.function("system").pos("1337").value("id").drop(); sp.disable_function.function("system").pos("0").value("id").drop(); sp.disable_function.function("system").pos("1").param_type("ARRAY").alias("1").drop(); -sp.disable_function.function("strlen").pos("0").value("id").alias("strlen array").drop(); +sp.disable_function.function("strtoupper").pos("0").value("id").alias("strlen array").drop(); diff --git a/src/tests/disable_function/config/disabled_functions_ret_type_long.ini b/src/tests/disable_function/config/disabled_functions_ret_type_long.ini index 03abf8a..c68332b 100644 --- a/src/tests/disable_function/config/disabled_functions_ret_type_long.ini +++ b/src/tests/disable_function/config/disabled_functions_ret_type_long.ini @@ -1 +1 @@ -sp.disable_function.function("strlen").ret_type("long").drop().alias("Return value is a long"); +sp.disable_function.function("strpos").ret_type("long").drop().alias("Return value is a long"); diff --git a/src/tests/disable_function/disabled_function_local_var.phpt b/src/tests/disable_function/disabled_function_local_var.phpt index 99b2b08..58dc2ea 100644 --- a/src/tests/disable_function/disabled_function_local_var.phpt +++ b/src/tests/disable_function/disabled_function_local_var.phpt @@ -8,7 +8,7 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini --EXPECTF-- Value of a: 1338 -2 +ID Value of a: 1337 -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var.php on line 4 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var.php on line 4 diff --git a/src/tests/disable_function/disabled_function_local_var_10.phpt b/src/tests/disable_function/disabled_function_local_var_10.phpt index 4902972..e50a5a4 100644 --- a/src/tests/disable_function/disabled_function_local_var_10.phpt +++ b/src/tests/disable_function/disabled_function_local_var_10.phpt @@ -8,10 +8,10 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini Array('qwe'), '456' => Array('no block this')); var_dump($qwe); -strlen("qwe"); +strtoupper("qwe"); $qwe = Array('123' => Array('qwe'), '456' => Array(Array('block this'))); var_dump($qwe); -strlen("qwe"); +strtoupper("qwe"); ?> --EXPECTF-- array(2) { @@ -42,4 +42,4 @@ array(2) { } } -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_10.php on line 7 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_10.php on line 7 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_function_local_var_2.phpt b/src/tests/disable_function/disabled_function_local_var_2.phpt index 5b21d07..5a186cd 100644 --- a/src/tests/disable_function/disabled_function_local_var_2.phpt +++ b/src/tests/disable_function/disabled_function_local_var_2.phpt @@ -8,7 +8,7 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini --EXPECTF-- Value of a: 1338 -2 +ID Value of a: array(2) { ["qwe"]=> @@ -35,7 +35,7 @@ array(2) { [123]=> string(3) "nop" } -2 +ID Value of a: array(2) { ["qwe"]=> @@ -44,4 +44,4 @@ array(2) { string(5) "block" } -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_2.php on line 4 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_2.php on line 4 diff --git a/src/tests/disable_function/disabled_function_local_var_3.phpt b/src/tests/disable_function/disabled_function_local_var_3.phpt index 597be1d..6399a1e 100644 --- a/src/tests/disable_function/disabled_function_local_var_3.phpt +++ b/src/tests/disable_function/disabled_function_local_var_3.phpt @@ -7,7 +7,7 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini --FILE-- string(3) "nop" } -2 +ID Value of a: array(2) { ["qwe"]=> @@ -43,4 +43,4 @@ array(2) { } } -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_3.php on line 3 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_3.php on line 3 diff --git a/src/tests/disable_function/disabled_function_local_var_4.phpt b/src/tests/disable_function/disabled_function_local_var_4.phpt index b441576..f0b1291 100644 --- a/src/tests/disable_function/disabled_function_local_var_4.phpt +++ b/src/tests/disable_function/disabled_function_local_var_4.phpt @@ -40,7 +40,7 @@ class test_object { $d = new test_object($c); $a = 1338; function test(){ - strlen("qwe"); + strtoupper("qwe"); } echo "Valeur: " . $b['_GET]["obj->nop::qwe']["qwe"][$a]->uio . "\n"; test(); @@ -54,4 +54,4 @@ test(); Valeur: valeur de a Valeur: valeur de apres -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_4.php on line 36 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_4.php on line 36 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_function_local_var_5.phpt b/src/tests/disable_function/disabled_function_local_var_5.phpt index 602e96e..431bbf9 100644 --- a/src/tests/disable_function/disabled_function_local_var_5.phpt +++ b/src/tests/disable_function/disabled_function_local_var_5.phpt @@ -7,7 +7,7 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini --FILE-- string(16) "not a good value" } -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_5.php on line 3 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_5.php on line 3 diff --git a/src/tests/disable_function/disabled_function_local_var_6.phpt b/src/tests/disable_function/disabled_function_local_var_6.phpt index 1866353..0bb9f6d 100644 --- a/src/tests/disable_function/disabled_function_local_var_6.phpt +++ b/src/tests/disable_function/disabled_function_local_var_6.phpt @@ -8,7 +8,7 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini --EXPECTF-- Valeur: qwerty -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_8.php on line 8 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_8.php on line 8 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_function_local_var_9.phpt b/src/tests/disable_function/disabled_function_local_var_9.phpt index 458d878..5844458 100644 --- a/src/tests/disable_function/disabled_function_local_var_9.phpt +++ b/src/tests/disable_function/disabled_function_local_var_9.phpt @@ -12,10 +12,10 @@ namespace qwe { namespace asd { const asd = 'qwe'; echo "Valeur: " . \qwe\QWE[123]. "\n"; - strlen("qwe"); + strtoupper("qwe"); } ?> --EXPECTF-- Valeur: asdfgh -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_9.php on line 8 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_9.php on line 8 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_function_local_var_const.phpt b/src/tests/disable_function/disabled_function_local_var_const.phpt index 8d9d58a..2013f6d 100644 --- a/src/tests/disable_function/disabled_function_local_var_const.phpt +++ b/src/tests/disable_function/disabled_function_local_var_const.phpt @@ -8,7 +8,7 @@ sp.configuration_file={PWD}/config/disabled_function_local_var_const.ini --EXPECTF-- -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_const.php on line 4 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_const.php on line 4 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_function_local_var_crash.phpt b/src/tests/disable_function/disabled_function_local_var_crash.phpt index 8dec946..3381b6c 100644 --- a/src/tests/disable_function/disabled_function_local_var_crash.phpt +++ b/src/tests/disable_function/disabled_function_local_var_crash.phpt @@ -7,12 +7,12 @@ sp.configuration_file={PWD}/config/disabled_function_local_var.ini --FILE-- --EXPECTF-- -2 +ID test diff --git a/src/tests/disable_function/disabled_function_local_var_obj.phpt b/src/tests/disable_function/disabled_function_local_var_obj.phpt index 29d57cc..89e423a 100644 --- a/src/tests/disable_function/disabled_function_local_var_obj.phpt +++ b/src/tests/disable_function/disabled_function_local_var_obj.phpt @@ -16,11 +16,11 @@ class test_class { $test_array = ['qwe']; $arg = 'qwe'; $test = new test_class('qwe', 'qwe'); -echo strlen($test->$arg) . "\n"; +echo strtoupper($test->$arg) . "\n"; $test = new test_class('qwe', 'nop_object'); -echo strlen($test->$arg) . "\n"; +echo strtoupper($test->$arg) . "\n"; ?> --EXPECTF-- -3 +QWE -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_local_var_obj.php on line 14 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_local_var_obj.php on line 14 diff --git a/src/tests/disable_function/disabled_function_super_global_var.phpt b/src/tests/disable_function/disabled_function_super_global_var.phpt index d97194a..196d9e2 100644 --- a/src/tests/disable_function/disabled_function_super_global_var.phpt +++ b/src/tests/disable_function/disabled_function_super_global_var.phpt @@ -9,13 +9,13 @@ bla=test --FILE-- --EXPECTF-- -4 +TEST -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_function_super_global_var.php on line 3 +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_function_super_global_var.php on line 3 diff --git a/src/tests/disable_function/disabled_functions_mb.phpt b/src/tests/disable_function/disabled_functions_mb.phpt index a2fd99e..923de8e 100644 --- a/src/tests/disable_function/disabled_functions_mb.phpt +++ b/src/tests/disable_function/disabled_functions_mb.phpt @@ -6,7 +6,7 @@ Disable functions sp.configuration_file={PWD}/config/disabled_functions_mb.ini --FILE-- --EXPECTF-- -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_functions_mb.php on line 2 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_functions_mb.php on line 2 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_functions_param_pos2.phpt b/src/tests/disable_function/disabled_functions_param_pos2.phpt index 87e18c0..7134fdd 100644 --- a/src/tests/disable_function/disabled_functions_param_pos2.phpt +++ b/src/tests/disable_function/disabled_functions_param_pos2.phpt @@ -6,8 +6,8 @@ Disable functions - match on argument's position, not the first time sp.configuration_file={PWD}/config/disabled_functions_pos.ini --FILE-- --EXPECTF-- -Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen', because its argument 'str' content (id) matched the rule 'strlen array' in %a/disabled_functions_param_pos2.php on line 3 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper', because its argument 'str' content (id) matched the rule 'strlen array' in %a/disabled_functions_param_pos2.php on line 3 \ No newline at end of file diff --git a/src/tests/disable_function/disabled_functions_regexp_multiple.phpt b/src/tests/disable_function/disabled_functions_regexp_multiple.phpt index 79f1fc7..5f68a00 100644 --- a/src/tests/disable_function/disabled_functions_regexp_multiple.phpt +++ b/src/tests/disable_function/disabled_functions_regexp_multiple.phpt @@ -6,14 +6,14 @@ Disable functions sp.configuration_file={PWD}/config/disabled_functions_regexp.ini --FILE-- --EXPECTF-- -Warning: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strlen' in %a/disabled_functions_regexp_multiple.php on line 2 -2 +Warning: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strtoupper' in %a/disabled_functions_regexp_multiple.php on line 2 +ID Warning: [snuffleupagus][disabled_function] Aborted execution on call of the function 'strcmp' in %a/disabled_functions_regexp_multiple.php on line 3 -1 -After \ No newline at end of file +After diff --git a/src/tests/disable_function/disabled_functions_ret_type_long.phpt b/src/tests/disable_function/disabled_functions_ret_type_long.phpt index c389533..cc78299 100644 --- a/src/tests/disable_function/disabled_functions_ret_type_long.phpt +++ b/src/tests/disable_function/disabled_functions_ret_type_long.phpt @@ -6,7 +6,7 @@ Disable functions check on `ret` by type matching (long). sp.configuration_file={PWD}/config/disabled_functions_ret_type_long.ini --FILE-- --EXPECTF-- -Fatal error: [snuffleupagus][disabled_function] Aborted execution on return of the function 'strlen', because the function returned '5', which matched the rule 'Return value is a long' in %a/disabled_functions_ret_type_long.php on line 2 \ No newline at end of file +Fatal error: [snuffleupagus][disabled_function] Aborted execution on return of the function 'strpos', because the function returned '1', which matched the rule 'Return value is a long' in %a/disabled_functions_ret_type_long.php on line 2 -- cgit v1.3