From 6ff8d6f4e2cc7cd89916b65d8f9e5d06cf756e3f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 19 May 2017 08:23:53 +0200 Subject: [PATCH] dropped support for HHVM --- .travis.yml | 5 +-- CHANGELOG | 1 + lib/Twig/Error.php | 5 --- lib/Twig/Extension/Core.php | 43 ++++++++----------- .../filters/urlencode_deprecated.test | 2 +- test/Twig/Tests/Fixtures/functions/date.test | 2 + test/Twig/Tests/NativeExtensionTest.php | 4 -- test/Twig/Tests/Node/Expression/CallTest.php | 4 -- 8 files changed, 22 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index 169f652b2..9e1656b96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,14 +15,13 @@ php: - 7.0 - 7.1 - nightly - - hhvm env: - TWIG_EXT=no - TWIG_EXT=yes before_install: - - if [[ ! $TRAVIS_PHP_VERSION = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi + - phpenv config-rm xdebug.ini install: - travis_retry composer install @@ -36,8 +35,6 @@ script: ./vendor/bin/simple-phpunit matrix: fast_finish: true exclude: - - php: hhvm - env: TWIG_EXT=yes - php: 7.0 env: TWIG_EXT=yes - php: 7.1 diff --git a/CHANGELOG b/CHANGELOG index b97aedb8f..69b6b694d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ * 1.34.0 (2017-XX-XX) + * dropped HHVM support * dropped PHP 5.2 support * 1.33.2 (2017-04-20) diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index 358a03b97..cf6d88dcc 100644 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -332,11 +332,6 @@ class Twig_Error extends Exception $r = new ReflectionObject($template); $file = $r->getFileName(); - // hhvm has a bug where eval'ed files comes out as the current directory - if (is_dir($file)) { - $file = ''; - } - $exceptions = array($e = $this); while (($e instanceof self || method_exists($e, 'getPrevious')) && $e = $e->getPrevious()) { $exceptions[] = $e; diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index ffa1d9fe1..2bdbfdae2 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -1,8 +1,7 @@ true, 'UTF-8' => true); - } else { - $htmlspecialcharsCharsets = array( - 'ISO-8859-1' => true, 'ISO8859-1' => true, - 'ISO-8859-15' => true, 'ISO8859-15' => true, - 'utf-8' => true, 'UTF-8' => true, - 'CP866' => true, 'IBM866' => true, '866' => true, - 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, - '1251' => true, - 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, - 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, - 'BIG5' => true, '950' => true, - 'GB2312' => true, '936' => true, - 'BIG5-HKSCS' => true, - 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, - 'EUC-JP' => true, 'EUCJP' => true, - 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, - ); - } - } + static $htmlspecialcharsCharsets = array( + 'ISO-8859-1' => true, 'ISO8859-1' => true, + 'ISO-8859-15' => true, 'ISO8859-15' => true, + 'utf-8' => true, 'UTF-8' => true, + 'CP866' => true, 'IBM866' => true, '866' => true, + 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, + '1251' => true, + 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, + 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, + 'BIG5' => true, '950' => true, + 'GB2312' => true, '936' => true, + 'BIG5-HKSCS' => true, + 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, + 'EUC-JP' => true, 'EUCJP' => true, + 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, + ); if (isset($htmlspecialcharsCharsets[$charset])) { return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); diff --git a/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test b/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test index 11800e9c0..35e50390d 100644 --- a/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test +++ b/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test @@ -1,5 +1,5 @@ --TEST-- -"url_encode" filter for PHP < 5.4 and HHVM +"url_encode" filter for PHP < 5.4 --CONDITION-- defined('PHP_QUERY_RFC3986') --TEMPLATE-- diff --git a/test/Twig/Tests/Fixtures/functions/date.test b/test/Twig/Tests/Fixtures/functions/date.test index a9ffe40fc..c9f464468 100644 --- a/test/Twig/Tests/Fixtures/functions/date.test +++ b/test/Twig/Tests/Fixtures/functions/date.test @@ -7,6 +7,7 @@ {{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} {{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} {{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }} +{{ date() > date('-1day') ? 'OK' : 'KO' }} --DATA-- date_default_timezone_set('UTC'); return array( @@ -23,3 +24,4 @@ OK OK OK OK +OK diff --git a/test/Twig/Tests/NativeExtensionTest.php b/test/Twig/Tests/NativeExtensionTest.php index a692be1f3..f1278eec3 100644 --- a/test/Twig/Tests/NativeExtensionTest.php +++ b/test/Twig/Tests/NativeExtensionTest.php @@ -16,10 +16,6 @@ class Twig_Tests_NativeExtensionTest extends PHPUnit_Framework_TestCase */ public function testGetProperties() { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)'); - } - $twig = new Twig_Environment(new Twig_Loader_Array(array('index' => '{{ d1.date }}{{ d2.date }}')), array( 'debug' => true, 'cache' => false, diff --git a/test/Twig/Tests/Node/Expression/CallTest.php b/test/Twig/Tests/Node/Expression/CallTest.php index 28c8148ff..be7b417b9 100644 --- a/test/Twig/Tests/Node/Expression/CallTest.php +++ b/test/Twig/Tests/Node/Expression/CallTest.php @@ -63,10 +63,6 @@ class Twig_Tests_Node_Expression_CallTest extends PHPUnit_Framework_TestCase */ public function testResolveArgumentsWithMissingValueForOptionalArgument() { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)'); - } - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare')); $node->getArguments('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true)); }