Browse code

dropped support for HHVM

Fabien Potencier authored on 19/05/2017 06:23:53
Showing 8 changed files
... ...
@@ -15,14 +15,13 @@ php:
15 15
     - 7.0
16 16
     - 7.1
17 17
     - nightly
18
-    - hhvm
19 18
 
20 19
 env:
21 20
     - TWIG_EXT=no
22 21
     - TWIG_EXT=yes
23 22
 
24 23
 before_install:
25
-    - if [[ ! $TRAVIS_PHP_VERSION = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
24
+    - phpenv config-rm xdebug.ini
26 25
 
27 26
 install:
28 27
     - travis_retry composer install
... ...
@@ -36,8 +35,6 @@ script: ./vendor/bin/simple-phpunit
36 35
 matrix:
37 36
     fast_finish: true
38 37
     exclude:
39
-        - php: hhvm
40
-          env: TWIG_EXT=yes
41 38
         - php: 7.0
42 39
           env: TWIG_EXT=yes
43 40
         - php: 7.1
... ...
@@ -1,5 +1,6 @@
1 1
 * 1.34.0 (2017-XX-XX)
2 2
 
3
+ * dropped HHVM support
3 4
  * dropped PHP 5.2 support
4 5
 
5 6
 * 1.33.2 (2017-04-20)
... ...
@@ -332,11 +332,6 @@ class Twig_Error extends Exception
332 332
         $r = new ReflectionObject($template);
333 333
         $file = $r->getFileName();
334 334
 
335
-        // hhvm has a bug where eval'ed files comes out as the current directory
336
-        if (is_dir($file)) {
337
-            $file = '';
338
-        }
339
-
340 335
         $exceptions = array($e = $this);
341 336
         while (($e instanceof self || method_exists($e, 'getPrevious')) && $e = $e->getPrevious()) {
342 337
             $exceptions[] = $e;
... ...
@@ -1,8 +1,7 @@
1 1
 <?php
2 2
 
3 3
 if (!defined('ENT_SUBSTITUTE')) {
4
-    // use 0 as hhvm does not support several flags yet
5
-    define('ENT_SUBSTITUTE', 0);
4
+    define('ENT_SUBSTITUTE', 8);
6 5
 }
7 6
 
8 7
 /*
... ...
@@ -1006,30 +1005,22 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
1006 1005
             // Using a static variable to avoid initializing the array
1007 1006
             // each time the function is called. Moving the declaration on the
1008 1007
             // top of the function slow downs other escaping strategies.
1009
-            static $htmlspecialcharsCharsets;
1010
-
1011
-            if (null === $htmlspecialcharsCharsets) {
1012
-                if (defined('HHVM_VERSION')) {
1013
-                    $htmlspecialcharsCharsets = array('utf-8' => true, 'UTF-8' => true);
1014
-                } else {
1015
-                    $htmlspecialcharsCharsets = array(
1016
-                        'ISO-8859-1' => true, 'ISO8859-1' => true,
1017
-                        'ISO-8859-15' => true, 'ISO8859-15' => true,
1018
-                        'utf-8' => true, 'UTF-8' => true,
1019
-                        'CP866' => true, 'IBM866' => true, '866' => true,
1020
-                        'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true,
1021
-                        '1251' => true,
1022
-                        'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true,
1023
-                        'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true,
1024
-                        'BIG5' => true, '950' => true,
1025
-                        'GB2312' => true, '936' => true,
1026
-                        'BIG5-HKSCS' => true,
1027
-                        'SHIFT_JIS' => true, 'SJIS' => true, '932' => true,
1028
-                        'EUC-JP' => true, 'EUCJP' => true,
1029
-                        'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true,
1030
-                    );
1031
-                }
1032
-            }
1008
+            static $htmlspecialcharsCharsets = array(
1009
+                'ISO-8859-1' => true, 'ISO8859-1' => true,
1010
+                'ISO-8859-15' => true, 'ISO8859-15' => true,
1011
+                'utf-8' => true, 'UTF-8' => true,
1012
+                'CP866' => true, 'IBM866' => true, '866' => true,
1013
+                'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true,
1014
+                '1251' => true,
1015
+                'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true,
1016
+                'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true,
1017
+                'BIG5' => true, '950' => true,
1018
+                'GB2312' => true, '936' => true,
1019
+                'BIG5-HKSCS' => true,
1020
+                'SHIFT_JIS' => true, 'SJIS' => true, '932' => true,
1021
+                'EUC-JP' => true, 'EUCJP' => true,
1022
+                'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true,
1023
+            );
1033 1024
 
1034 1025
             if (isset($htmlspecialcharsCharsets[$charset])) {
1035 1026
                 return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
... ...
@@ -1,5 +1,5 @@
1 1
 --TEST--
2
-"url_encode" filter for PHP < 5.4 and HHVM
2
+"url_encode" filter for PHP < 5.4
3 3
 --CONDITION--
4 4
 defined('PHP_QUERY_RFC3986')
5 5
 --TEMPLATE--
... ...
@@ -7,6 +7,7 @@
7 7
 {{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
8 8
 {{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
9 9
 {{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }}
10
+{{ date() > date('-1day') ? 'OK' : 'KO' }}
10 11
 --DATA--
11 12
 date_default_timezone_set('UTC');
12 13
 return array(
... ...
@@ -23,3 +24,4 @@ OK
23 24
 OK
24 25
 OK
25 26
 OK
27
+OK
... ...
@@ -16,10 +16,6 @@ class Twig_Tests_NativeExtensionTest extends PHPUnit_Framework_TestCase
16 16
      */
17 17
     public function testGetProperties()
18 18
     {
19
-        if (defined('HHVM_VERSION')) {
20
-            $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)');
21
-        }
22
-
23 19
         $twig = new Twig_Environment(new Twig_Loader_Array(array('index' => '{{ d1.date }}{{ d2.date }}')), array(
24 20
             'debug' => true,
25 21
             'cache' => false,
... ...
@@ -63,10 +63,6 @@ class Twig_Tests_Node_Expression_CallTest extends PHPUnit_Framework_TestCase
63 63
      */
64 64
     public function testResolveArgumentsWithMissingValueForOptionalArgument()
65 65
     {
66
-        if (defined('HHVM_VERSION')) {
67
-            $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)');
68
-        }
69
-
70 66
         $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare'));
71 67
         $node->getArguments('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true));
72 68
     }