summaryrefslogtreecommitdiff
path: root/src/tests/eval_whitelist_include_then_user.phpt
diff options
context:
space:
mode:
authorjvoisin2018-01-10 14:56:33 +0100
committerGitHub2018-01-10 14:56:33 +0100
commitad6b3e723fe26bf1a3a573aed776960916d35499 (patch)
treeeec9e15028f4529d776489d273bf9699333aa987 /src/tests/eval_whitelist_include_then_user.phpt
parentb6e5bc4557cca3abbcfd179e7143ea54b9844e49 (diff)
Eval whitelist
Implement whitelist in eval
Diffstat (limited to 'src/tests/eval_whitelist_include_then_user.phpt')
-rw-r--r--src/tests/eval_whitelist_include_then_user.phpt29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/eval_whitelist_include_then_user.phpt b/src/tests/eval_whitelist_include_then_user.phpt
new file mode 100644
index 0000000..6d4e36a
--- /dev/null
+++ b/src/tests/eval_whitelist_include_then_user.phpt
@@ -0,0 +1,29 @@
1--TEST--
2Eval whitelist - builtin function
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/eval_whitelist.ini
7--FILE--
8<?php
9$b = 1337;
10$dir = __DIR__;
11
12file_put_contents($dir . '/test.bla', '<?php $b = sin(1) ?>');
13
14$a = cos(1);
15echo "Outside of eval: $a\n";
16eval('$a = cos(5);');
17echo "After allowed eval: $a\n";
18eval("include_once('$dir' . '/test.bla');");
19echo "After eval: $b\n";
20?>
21--CLEAN--
22<?php
23$dir = __DIR__;
24unlink($dir . '/test.bla');
25?>
26--EXPECTF--
27Outside of eval: 0.54030230586814
28After allowed eval: 0.28366218546323
29[snuffleupagus][0.0.0.0][Eval_whitelist][drop] The function 'sin' isn't in the eval whitelist, dropping its call.