rspec/rules/S2115/php/rule.adoc
2022-02-04 16:28:24 +00:00

37 lines
778 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
[source,php]
----
// example of an empty password when connecting to a mysql database
$conn = new mysqli($servername, $username, "");
----
== Compliant Solution
[source,php]
----
// generate a secure password, set it to the username database, and store it in a environment variable for instance
$password = getenv('MYSQL_SECURE_PASSWORD');
// then connect to the database
$conn = new mysqli($servername, $username, $password);
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]