Loris S c622e8e4d3
Modify S5527: Learn-As-You-Code migration (#2269)
## Review

A dedicated reviewer checked the rule description successfully for:

- [x] logical errors and incorrect information
- [x] information gaps and missing content
- [x] text style and tone
- [x] PR summary and labels follow [the
guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)

---------

Co-authored-by: hendrik-buchwald-sonarsource <64110887+hendrik-buchwald-sonarsource@users.noreply.github.com>
2023-06-28 17:11:41 +02:00

38 lines
851 B
Plaintext

== How to fix it in cURL
=== Code examples
include::../../common/fix/code-rationale.adoc[]
:cert_variable_name: CURLOPT_SSL_VERIFYHOST
:cert_variable_unsafe_value: 0 or false
:cert_variable_safe_value: 2 or true
include::../../common/fix/code-rationale-setting.adoc[]
==== Noncompliant code example
[source,php,diff-id=1,diff-type=noncompliant]
----
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://example.com/');
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // Noncompliant
curl_exec($curl);
curl_close($curl);
----
==== Compliant solution
[source,php,diff-id=1,diff-type=compliant]
----
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://example.com/');
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_exec($curl);
curl_close($curl);
----
=== How does this work?
include::../../common/fix/validation.adoc[]