fixed PHP 5.2 compat

This commit is contained in:
Fabien Potencier
2015-07-03 12:11:52 +02:00
parent 641090378d
commit 82636dc93d
+6 -3
View File
@@ -86,9 +86,12 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
}
// avoid using the same PHP class name for different cases
$p = new ReflectionProperty($twig, 'templateClassPrefix');
$p->setAccessible(true);
$p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_');
// only for PHP 5.2+
if (PHP_VERSION_ID >= 50300) {
$p = new ReflectionProperty($twig, 'templateClassPrefix');
$p->setAccessible(true);
$p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_');
}
try {
$template = $twig->loadTemplate('index.twig');