fixed url escaping strategy for PHP 5.2
authorFabien Potencier <fabien.potencier@gmail.com>
Wed, 27 Jun 2012 09:18:21 +0000 (11:18 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Wed, 27 Jun 2012 09:18:21 +0000 (11:18 +0200)
lib/Twig/Extension/Core.php

index 0ebabc0..ed9ef2d 100644 (file)
@@ -872,6 +872,10 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
             return twig_convert_encoding($string, $charset, 'UTF-8');
 
         case 'url':
+            if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+                return str_replace('%7E', '~', rawurlencode($string));
+            }
+
             return rawurlencode($string);
 
         default: