mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 03:46:39 +00:00
fixed PHP 5.2 compat
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user