@@ -35,7 +35,7 @@ class ProfilerController
35
35
private $ templates ;
36
36
private $ toolbarPosition ;
37
37
private $ cspHandler ;
38
- private $ kernelRootDir ;
38
+ private $ rootDir ;
39
39
40
40
/**
41
41
* Constructor.
@@ -45,17 +45,17 @@ class ProfilerController
45
45
* @param \Twig_Environment $twig The twig environment
46
46
* @param array $templates The templates
47
47
* @param string $toolbarPosition The toolbar position (top, bottom, normal, or null -- use the configuration)
48
- * @param string $kernelRootDir The Kernel root directory
48
+ * @param string $rootDir The project root directory
49
49
*/
50
- public function __construct (UrlGeneratorInterface $ generator , Profiler $ profiler = null , \Twig_Environment $ twig , array $ templates , $ toolbarPosition = 'normal ' , ContentSecurityPolicyHandler $ cspHandler = null , $ kernelRootDir = null )
50
+ public function __construct (UrlGeneratorInterface $ generator , Profiler $ profiler = null , \Twig_Environment $ twig , array $ templates , $ toolbarPosition = 'normal ' , ContentSecurityPolicyHandler $ cspHandler = null , $ rootDir = null )
51
51
{
52
52
$ this ->generator = $ generator ;
53
53
$ this ->profiler = $ profiler ;
54
54
$ this ->twig = $ twig ;
55
55
$ this ->templates = $ templates ;
56
56
$ this ->toolbarPosition = $ toolbarPosition ;
57
57
$ this ->cspHandler = $ cspHandler ;
58
- $ this ->kernelRootDir = $ kernelRootDir ;
58
+ $ this ->rootDir = $ rootDir ;
59
59
}
60
60
61
61
/**
@@ -406,8 +406,8 @@ public function phpinfoAction()
406
406
*/
407
407
public function openAction (Request $ request )
408
408
{
409
- if (null === $ this ->kernelRootDir ) {
410
- throw new NotFoundHttpException ('KernelRootDir should be set. ' );
409
+ if (null === $ this ->rootDir ) {
410
+ throw new NotFoundHttpException ('rootDir should be set. ' );
411
411
}
412
412
413
413
if ($ this ->profiler ) {
@@ -417,7 +417,7 @@ public function openAction(Request $request)
417
417
$ file = $ request ->query ->get ('file ' );
418
418
$ line = $ request ->query ->get ('line ' );
419
419
420
- $ filename = dirname ( $ this ->kernelRootDir ) .DIRECTORY_SEPARATOR .$ file ;
420
+ $ filename = $ this ->rootDir .DIRECTORY_SEPARATOR .$ file ;
421
421
422
422
if (preg_match ("'(^|[/ \\\\])\.\.?([/ \\\\]|$)' " , $ file ) || !is_readable ($ filename )) {
423
423
throw new NotFoundHttpException (sprintf ('The file "%s" cannot be opened. ' , $ file ));
0 commit comments