forked from jvoisin/snuffleupagus
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrote parameter matching logic. breaks compatibility with previous …
…versions.
- Loading branch information
Showing
16 changed files
with
220 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/tests/disable_function/config/disabled_function_excess_args.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sp.disable_function.function("foo_excess_args").pos("3").value("blubb").drop() |
12 changes: 12 additions & 0 deletions
12
src/tests/disable_function/config/disabled_function_named_args.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
sp.disable_function.function("foo_named_args_pos").pos("0").value("bob").drop() | ||
sp.disable_function.function("foo_named_args_param").param("name").value("bob").drop() | ||
|
||
sp.disable_function.function("foo_named_args_ooo_pos").pos("0").value("bob").drop() | ||
sp.disable_function.function("foo_named_args_ooo_param").param("name").value("bob").drop() | ||
|
||
sp.disable_function.function("foo_named_args_ooo_opt_pos").pos("2").value("green").drop() | ||
sp.disable_function.function("foo_named_args_ooo_opt_param").param("color").value("green").drop() | ||
|
||
sp.disable_function.function("foo_named_args_skip_pos").pos("2").value("green").drop() | ||
sp.disable_function.function("foo_named_args_skip_param").param("color").value("green").drop() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("system").pos("0").param_type("ARRAY").alias("1").drop(); | ||
sp.disable_function.function("strtoupper").pos("0").value("id").alias("strlen array").drop(); |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_excess_args.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with excess arguments | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_excess_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_excess_args($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_excess_args("bob", "hi", "green", "blubb"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_excess_args' in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_ooo_opt_param.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with out-of-order named optional arguments by matching argument name | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_ooo_opt_param($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_ooo_opt_param("bob", color: "green", greeting: "xxx"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_opt_param', because its argument '$color'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_ooo_opt_pos.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with out-of-order named optional arguments by matching argument position | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_ooo_opt_pos($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_ooo_opt_pos("bob", color: "green", greeting: "xxx"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_opt_pos', because its argument 'color'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_ooo_param.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with out-of-order named arguments by matching argument name | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_ooo_param($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_ooo_param(greeting: "hello!", name: "bob"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_param', because its argument '$name'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_ooo_pos.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with out-of-order named arguments by matching argument position | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_ooo_pos($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_ooo_pos(greeting: "hello!", name: "bob"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_pos', because its argument 'name'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_param.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with named arguments by matching argument name | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_param($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_param(name: "bob", greeting: "hello!"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_param', because its argument '$name'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_pos.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with named arguments by matching argument position | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_pos($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_pos(name: "bob", greeting: "hello!"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_pos', because its argument 'name'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_skip_param.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with named arguments (skipping opt. args) by matching argument name | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_skip_param($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_skip_param("bob", color: "green"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_skip_param', because its argument '$color'%s matched a rule in %s.php on line %d |
14 changes: 14 additions & 0 deletions
14
src/tests/disable_function/disabled_function_named_args_skip_pos.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Disable functions with named arguments (skipping opt. args) by matching argument position | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
--FILE-- | ||
<?php | ||
function foo_named_args_skip_pos($name, $greeting='HI!', $color='red') { | ||
echo "boo\n"; | ||
} | ||
foo_named_args_skip_pos("bob", color: "green"); | ||
--EXPECTF-- | ||
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_skip_pos', because its argument 'color'%s matched a rule in %s.php on line %d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters