summaryrefslogtreecommitdiff
path: root/src/tests/disabled_function_local_var_obj.phpt
diff options
context:
space:
mode:
authorxXx-caillou-xXx2017-12-20 18:09:53 +0100
committerjvoisin2017-12-20 18:09:53 +0100
commite7f541396715ee2895abcf73044b91ae9b746201 (patch)
treeba0e9765e7f14f04b92585df1f3fcd1830ab4b00 /src/tests/disabled_function_local_var_obj.phpt
parent8d6cc4f2b63c3f0dc31fe6cecd34ac023ea1cccb (diff)
Better parsing of the rules
Thanks to this huge commit from @xXx-caillou-xXx, we can now write amazingly flexible rules.
Diffstat (limited to 'src/tests/disabled_function_local_var_obj.phpt')
-rw-r--r--src/tests/disabled_function_local_var_obj.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tests/disabled_function_local_var_obj.phpt b/src/tests/disabled_function_local_var_obj.phpt
new file mode 100644
index 0000000..868ea4c
--- /dev/null
+++ b/src/tests/disabled_function_local_var_obj.phpt
@@ -0,0 +1,25 @@
1--TEST--
2Disable functions - match on a local variable
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/disabled_function_local_var_obj.ini
7--FILE--
8<?php
9class test_class {
10 public $qwe = 'value';
11 function __construct($arg, $value) {
12 $this->$arg = $value;
13 }
14}
15
16$test_array = ['qwe'];
17$arg = 'qwe';
18$test = new test_class('qwe', 'qwe');
19echo strlen($test->$arg) . "\n";
20$test = new test_class('qwe', 'nop_object');
21echo strlen($test->$arg) . "\n";
22?>
23--EXPECTF--
243
25[snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'strlen' in %a/tests/disabled_function_local_var_obj.php:%d has been disabled.