rspec/rules/S6173/php/rule.adoc
2022-09-08 11:35:12 +02:00

45 lines
720 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
[source,php]
----
$input = $_GET["input"];
call_user_func($input, "abc"); # Noncompliant
$input(); # Noncompliant
$o = new $input(); # Noncompliant
----
== Compliant Solution
[source,php]
----
$input = $_GET["input"];
if(in_array($input, $allowlist, true)) {
call_user_func($input, "abc");
$input();
$o = new $input();
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]