title: Functional test fails due to corrupted token extracted from email
body: <p>In a Symfony 5 project, a functional test of user registration fails when the confirmation token is corrupted when extracted from an email. (Email is done with SwiftMailer due to its ability to send logs.)</p>
  <p>The test begins with completing a form with a user name and email address. On Save the email is sent. Because the test includes <code>$this-&gt;client-&gt;followRedirects(false);</code> the test has access to the email's contents. When the token is extracted from the email it includes extra characters. So when the test tries to <code>$this-&gt;client-&gt;request('GET', '/register/reset/' . $token);</code> the test fails due to invalid registration data.</p>
  <p>Here's a version of the test:</p>
  <pre><code>    public function testReplacementEmail() {
          $this-&gt;client-&gt;clickLink('Staff');
          $this-&gt;client-&gt;clickLink('Replace');
          $this-&gt;client-&gt;followRedirects(false);
          $this-&gt;client-&gt;submitForm('Save', [
              'user[fname]' =&gt; 'Useless',
              'user[sname]' =&gt; 'Garbage',
              'user[email]' =&gt; 'ugar@bogus.info'
          ]);
          $mailCollector = $this-&gt;client-&gt;getProfile()-&gt;getCollector('swiftmailer');
  
          $this-&gt;assertSame(1, $mailCollector-&gt;getMessageCount());
          $collectedMessages = $mailCollector-&gt;getMessages();
          $message = $collectedMessages[0];
          $this-&gt;assertStringContainsString('has been asked to designate', $message);
  
          $string = 'register/reset/';
          $offset = strlen($string);
          $pos = strpos($message, $string) + $offset;
          $token = substr($message, $pos, 32);
          var_dump($token);
  
          $this-&gt;client-&gt;followRedirects(true);
          $this-&gt;client-&gt;request('GET', '/logout');
          $this-&gt;client-&gt;request('GET', '/register/reset/' . $token);
          $this-&gt;client-&gt;submitForm('Save', [
              'new_password[plainPassword][first]' =&gt; '123Abc',
              'new_password[plainPassword][second]' =&gt; '123Abc',
          ]);
  
          $this-&gt;assertStringContainsString('You are now the registered representative', $this-&gt;client-&gt;getResponse()-&gt;getContent());
      }
  </code></pre>
  <p>I have included in the controller that handles the <code>Replace</code> link the lines <code>$token = md5(uniqid(rand(), true));var_dump($token);</code> in order to get an unadulterated token. When the test is run, those lines produce something like this:</p>
  <p><code>string(32) &quot;ad47260162194f9ab6deb55eb4f38178&quot;</code></p>
  <p>If I use <code>var_dump($message);</code> in the test to access the contents of the email I can see something like this:</p>
  <p><code>href=&quot;http://localhost/register/reset/ad47260162194f9ab6deb55eb4f38178&quot;</code></p>
  <p>Yet where the test includes <code>var_dump($token);</code> I instead see something like this:</p>
  <pre><code>string(32) &quot;7260162194f9ab6d=
  eb55eb4f38178&quot;
  </code></pre>
  <p>The presence of <code>=\r\n</code> (on a Windows system) causes the link to fail.</p>
  <p>I would like to know why these extra characters occur and how to avoid them if at all possible.</p>