Skip to content

Commit

Permalink
fixed PHP 5.2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jul 3, 2015
1 parent 6410903 commit 82636dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Twig/Test/IntegrationTestCase.php
Expand Up @@ -86,9 +86,12 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
}

// 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');
Expand Down

0 comments on commit 82636dc

Please sign in to comment.