From 7b2bdbe35192f9ee4ef09f26c7eff48a44397485 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 3 Mar 2018 07:46:21 -0800 Subject: [PATCH 1/2] fixed profiler unicity when several ones are registered --- CHANGELOG | 2 +- lib/Twig/Profiler/NodeVisitor/Profiler.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7f36cb67b..13b53116c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/lib/Twig/Profiler/NodeVisitor/Profiler.php b/lib/Twig/Profiler/NodeVisitor/Profiler.php index 45253c7e6..5db41fea7 100644 --- a/lib/Twig/Profiler/NodeVisitor/Profiler.php +++ b/lib/Twig/Profiler/NodeVisitor/Profiler.php @@ -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() From 0ee096f0926fd495063ab5bcd62ce456ed51a88a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 3 Mar 2018 07:53:48 -0800 Subject: [PATCH 2/2] fixed test --- lib/Twig/Profiler/Profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Twig/Profiler/Profile.php b/lib/Twig/Profiler/Profile.php index aabf551e8..3fdc1a8ae 100644 --- a/lib/Twig/Profiler/Profile.php +++ b/lib/Twig/Profiler/Profile.php @@ -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; }