summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorxXx-caillou-xXx2018-07-13 11:38:51 +0200
committerjvoisin2018-07-13 09:38:51 +0000
commit94649dee9e8b8b6c6c28b79d565ae7b388e3d6d9 (patch)
tree106df2ad6824ec1c352fd57f577372778e64385b /src/tests
parent7963580d72a358975133f86f01de2d2eab08ba38 (diff)
Allow rules matching on echo and print
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/config/disabled_function_echo.ini2
-rw-r--r--src/tests/disabled_function_echo.phpt18
-rw-r--r--src/tests/disabled_function_echo_2.phpt14
-rw-r--r--src/tests/disabled_function_echo_local_var.phpt20
4 files changed, 54 insertions, 0 deletions
diff --git a/src/tests/config/disabled_function_echo.ini b/src/tests/config/disabled_function_echo.ini
new file mode 100644
index 0000000..39bc5e3
--- /dev/null
+++ b/src/tests/config/disabled_function_echo.ini
@@ -0,0 +1,2 @@
1sp.disable_function.function("echo").var("$abc").value("123").drop();
2sp.disable_function.function("echo").value("oops").drop();
diff --git a/src/tests/disabled_function_echo.phpt b/src/tests/disabled_function_echo.phpt
new file mode 100644
index 0000000..a884e4a
--- /dev/null
+++ b/src/tests/disabled_function_echo.phpt
@@ -0,0 +1,18 @@
1--TEST--
2Echo hooking
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/disabled_function_echo.ini
7--FILE--
8<?php
9function test($a) {
10 print "$a";
11}
12echo "qwe";
13test("rty");
14test("oops");
15?>
16--CLEAN--
17--EXPECTF--
18qwerty[snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/tests/disabled_function_echo.php:3.
diff --git a/src/tests/disabled_function_echo_2.phpt b/src/tests/disabled_function_echo_2.phpt
new file mode 100644
index 0000000..20dbee4
--- /dev/null
+++ b/src/tests/disabled_function_echo_2.phpt
@@ -0,0 +1,14 @@
1--TEST--
2Echo hooking
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/disabled_function_echo.ini
7--FILE--
8<?php
9echo "qwe";
10echo "1", "oops";
11?>
12--CLEAN--
13--EXPECTF--
14qwe1[snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/tests/disabled_function_echo_2.php:3.
diff --git a/src/tests/disabled_function_echo_local_var.phpt b/src/tests/disabled_function_echo_local_var.phpt
new file mode 100644
index 0000000..bfa3c8c
--- /dev/null
+++ b/src/tests/disabled_function_echo_local_var.phpt
@@ -0,0 +1,20 @@
1--TEST--
2Echo hooking
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/disabled_function_echo.ini
7--FILE--
8<?php
9function test() {
10 print "3\n";
11}
12$abc = 1;
13test();
14$abc = 123;
15test();
16?>
17--CLEAN--
18--EXPECTF--
193
20[snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/tests/disabled_function_echo_local_var.php:3.