From e7f541396715ee2895abcf73044b91ae9b746201 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Wed, 20 Dec 2017 18:09:53 +0100 Subject: Better parsing of the rules Thanks to this huge commit from @xXx-caillou-xXx, we can now write amazingly flexible rules.--- src/tests/disabled_function_local_var_4.phpt | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/tests/disabled_function_local_var_4.phpt (limited to 'src/tests/disabled_function_local_var_4.phpt') diff --git a/src/tests/disabled_function_local_var_4.phpt b/src/tests/disabled_function_local_var_4.phpt new file mode 100644 index 0000000..ae8d713 --- /dev/null +++ b/src/tests/disabled_function_local_var_4.phpt @@ -0,0 +1,56 @@ +--TEST-- +Disable functions - match on a local variable +--SKIPIF-- + +--INI-- +sp.configuration_file={PWD}/config/disabled_function_local_var_2.ini +--FILE-- +nop]'] = Array(); +$b['_GET[obj->nop]']["qwe"] = Array(); +$b[456] = Array(); +$b[456]['zxc'] = "qwe"; +$b[456]['nop'] = "nop"; +$b['_GET[obj->nop]']["qwe"][321] = "Yeay"; +$b["123"] = "qwe"; +$b["123a"] = "foo"; +$b["asd"] = "zxc"; +$b['_GET[obj->nop]']["qwe"][1337] = (Object)(['uio' => "valeur de apres"]); +$b['_GET[obj->nop]']["qwe"][1338] = (Object)(['uio' => "valeur de a"]); +$c = (Object)(['qwe' => Array(\qwe\UNE_CONSTANTE => 'zxc')]); +$idk = 'test_asd'; +$class_name = 'test_object'; +class test_object { + const TEST_VALUE = ['constant' => 'truc']; + private $asd = "qwe"; + public $qwe = 'bar'; + private $test_asd = ''; + function __construct($asd) { + $this->test_asd = $asd; + } + function do_a_barell_roll() { + var_dump($this->test_asd); + } +} +$d = new test_object($c); +$a = 1338; +function test(){ + strlen("qwe"); +} +echo "Valeur: " . $b['_GET[obj->nop]']["qwe"][$a]->uio . "\n"; +test(); + +$a = 1337; +echo "Valeur: " . $b['_GET[obj->nop]']["qwe"][$a]->uio . "\n"; +test(); +} +?> +--EXPECTF-- +Valeur: valeur de a +Valeur: valeur de apres +[snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'strlen' in %a/tests/disabled_function_local_var_4.php:%d has been disabled. -- cgit v1.3