35 lines
640 B
Plaintext
35 lines
640 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../rationale.adoc[]
|
|
|
|
include::../impact.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
=== Code examples
|
|
|
|
include::../common/fix/code-rationale.adoc[]
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,php,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
$id = $_GET['id'];
|
|
file_get_contents('http://example.com/api/user/' . $id); // Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,php,diff-id=1,diff-type=compliant]
|
|
----
|
|
$id = $_GET['id'];
|
|
file_get_contents('http://example.com/api/user/?u=' . urlencode($id));
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../common/fix/encoding.adoc[]
|
|
|
|
== Resources
|
|
|
|
include::../common/resources/standards.adoc[] |