title: Twig "trim" not working as expected
body: <p>Using this Twig template:</p>
  
  <pre><code>{% for line in lines%}
      {{line}} after trim('.php') is: {{line|trim('.php')}}&lt;br&gt;
  {% endfor %}
  </code></pre>
  
  <p>Using a controller in Silex to render the above template:</p>
  
  <pre><code>$app-&gt;get('/try', function () use ($app)
  {
      $lines=[];
      $lines[]='123.php';
      $lines[]='news.php';
      $lines[]='map.php';
  
      return $app['twig']-&gt;render('try.html.twig', ['lines'=&gt;$lines]);
  }
      );
  </code></pre>
  
  <p>I receive the following output:</p>
  
  <pre><code>123.php after trim('.php') is: 123
  news.php after trim('.php') is: news
  map.php after trim('.php') is: ma
  </code></pre>
  
  <p>Note the last trim: <code>map.php</code> should become <code>map</code> but is now <code>ma</code>. </p>