Modify rule S6173(PHP): Add more code examples
This commit is contained in:
parent
d8d4be1472
commit
a0213d80bd
@ -7,6 +7,8 @@ include::../description.adoc[]
|
||||
$input = $_GET["input"];
|
||||
|
||||
call_user_func($input, "abc"); # Noncompliant
|
||||
$input(); # Noncompliant
|
||||
$o = new $input(); # Noncompliant
|
||||
----
|
||||
|
||||
== Compliant Solution
|
||||
@ -17,6 +19,8 @@ $input = $_GET["input"];
|
||||
|
||||
if(in_array($input, $allowlist, true)) {
|
||||
call_user_func($input, "abc");
|
||||
$input();
|
||||
$o = new $input();
|
||||
}
|
||||
----
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user