<p dir="auto">I'm using Memcached  I set the following session<br>
<code class="notranslate">$m = $this-&gt;get("session.handler.memcached"); $m-&gt;write($session-&gt;getId(),array("lol"=&gt;"mdr")); $m-&gt;close();</code><br>
In another page , I execute this :<br>
<code class="notranslate">$session = $this-&gt;getRequest()-&gt;getSession(); $session-&gt;start(); $m = $this-&gt;get("session.handler.memcached"); var_dump($m-&gt;read($session-&gt;getId())['lol']); $m-&gt;close();</code></p>
<p dir="auto">Sometimes I get "mdr" sometimes I get "_" . is this a bug ?<br>
is the same session gets overriden ?</p>
<p dir="auto">Let's say you add a time field like this:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/** @var FormBuilderInterface $builder */
$builder-&gt;add('time', TimeTime::class, [
  'model_timezone' =&gt; 'UTC',
  'view_timezone' =&gt; 'America/New_York',
]);"><pre class="notranslate"><span class="pl-c">/** @var FormBuilderInterface $builder */</span>
<span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'time'</span>, <span class="pl-v">TimeTime</span>::class, [
  <span class="pl-s">'model_timezone'</span> =&gt; <span class="pl-s">'UTC'</span>,
  <span class="pl-s">'view_timezone'</span> =&gt; <span class="pl-s">'America/New_York'</span>,
]);</pre></div>
<p dir="auto">So users are entering the "time" field in their local time. Right now (2016-03-30) this happens to be during daylight savings time in (most of) the US: UTC is four hours ahead.</p>
<p dir="auto">Saving the form with a time value of 1AM, I would expect the UTC time to be 5am. Instead it comes back as 6am because the <a href="https://github.com/symfony/symfony/blob/86eee064dd9953a5739adac2a4b5cbaa486c9081/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php#L183-L185">model transformer</a> uses 1970-01-01 as the date (not during DST).</p>
<p dir="auto">I'm not sure if this is actually a bug or not. The behavior makes sense when you look at it from the perspective of the field being time only without a frame of reference for the date -- it doesn't care about DST.</p>
<p dir="auto">But the fact that it does conversion from one TZ to another makes it a bit weird: the conversion doesn't act as expected.</p>
<p dir="auto">Might be useful to pass a reference date to the form that the model transformer can use and default that value to 1970-01-01?</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$builder-&gt;add('time', TimeTime::class, [
  'model_timezone' =&gt; 'UTC',
  'view_timezone' =&gt; 'America/New_York',
  'current_date' =&gt; new \DateTime('now'), // default to 1970-01-01
]);"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'time'</span>, <span class="pl-v">TimeTime</span>::class, [
  <span class="pl-s">'model_timezone'</span> =&gt; <span class="pl-s">'UTC'</span>,
  <span class="pl-s">'view_timezone'</span> =&gt; <span class="pl-s">'America/New_York'</span>,
  <span class="pl-s">'current_date'</span> =&gt; <span class="pl-k">new</span> \<span class="pl-v">DateTime</span>(<span class="pl-s">'now'</span>), <span class="pl-c">// default to 1970-01-01</span>
]);</pre></div>