bug #2647 Fix profiler unicity when several ones are registered (fabpot)

This PR was squashed before being merged into the 1.x branch (closes #2647).

Discussion
----------

Fix profiler unicity when several ones are registered

Closes #2627, closes #2643, alternative to #2645

What happens is that both Twig and Symfony register a Twig profiler. Unfortunately, the current code does assign the same variable for both profiler, which means that trying to close it twice does not work.

Commits
-------

0ee096f0 fixed test
7b2bdbe3 fixed profiler unicity when several ones are registered
This commit is contained in:
Fabien Potencier
2018-03-03 08:18:26 -08:00
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
* 1.35.2 (2018-XX-XX)
* n/a
* fixed a regression in the way the profiler is registered in templates
* 1.35.1 (2018-03-02)
+1 -1
View File
@@ -55,7 +55,7 @@ class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
private function getVarName()
{
return sprintf('__internal_%s', hash('sha256', __METHOD__));
return sprintf('__internal_%s', hash('sha256', $this->extensionName));
}
public function getPriority()
+1 -1
View File
@@ -76,7 +76,7 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
return $this->profiles;
}
public function addProfile(self $profile)
public function addProfile(Twig_Profiler_Profile $profile)
{
$this->profiles[] = $profile;
}