include::../description.adoc[]

== Noncompliant Code Example

[source,php]
----
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

public function index(Request $request)
{
    $value = $request->query->get('v');

    $response = new Response('');
    $response->headers->set('Set-Cookie', $value);  // Noncompliant
    $cookie = Cookie::create('PHPSESSID', $value);  // Noncompliant
    $response->headers->setCookie($cookie);

    return $response;
}
----

== Compliant Solution

[source,php]
----
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

public function index(Request $request)
{
    $value = $request->query->get('v');

    $response = new Response('');
    $response->headers->set('X-Data', $value);
    $cookie = Cookie::create('data', $value);
    $response->headers->setCookie($cookie);

    return $response;
}
----

include::../see.adoc[]


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../highlighting.adoc[]

endif::env-github,rspecator-view[]
