Modify rule S6173(PHP): Add more code examples

This commit is contained in:
Karim El Ouerghemmi 2022-09-08 11:35:12 +02:00 committed by GitHub
parent d8d4be1472
commit a0213d80bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}
----