minor #30916 [Profiler] Update ProfilerController.php (error56)
This PR was squashed before being merged into the 4.3-dev branch (closes #30916).
Discussion
----------
[Profiler] Update ProfilerController.php
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->
Commits
-------
6e0785f8c5
[Profiler] Update ProfilerController.php
This commit is contained in:
commit
f587944e61
@ -54,11 +54,7 @@ class ProfilerController
|
|||||||
*/
|
*/
|
||||||
public function homeAction()
|
public function homeAction()
|
||||||
{
|
{
|
||||||
if (null === $this->profiler) {
|
$this->denyAccessIfProfilerDisabled();
|
||||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->profiler->disable();
|
|
||||||
|
|
||||||
return new RedirectResponse($this->generator->generate('_profiler_search_results', ['token' => 'empty', 'limit' => 10]), 302, ['Content-Type' => 'text/html']);
|
return new RedirectResponse($this->generator->generate('_profiler_search_results', ['token' => 'empty', 'limit' => 10]), 302, ['Content-Type' => 'text/html']);
|
||||||
}
|
}
|
||||||
@ -75,11 +71,7 @@ class ProfilerController
|
|||||||
*/
|
*/
|
||||||
public function panelAction(Request $request, $token)
|
public function panelAction(Request $request, $token)
|
||||||
{
|
{
|
||||||
if (null === $this->profiler) {
|
$this->denyAccessIfProfilerDisabled();
|
||||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->profiler->disable();
|
|
||||||
|
|
||||||
if (null !== $this->cspHandler) {
|
if (null !== $this->cspHandler) {
|
||||||
$this->cspHandler->disableCsp();
|
$this->cspHandler->disableCsp();
|
||||||
@ -170,11 +162,7 @@ class ProfilerController
|
|||||||
*/
|
*/
|
||||||
public function searchBarAction(Request $request)
|
public function searchBarAction(Request $request)
|
||||||
{
|
{
|
||||||
if (null === $this->profiler) {
|
$this->denyAccessIfProfilerDisabled();
|
||||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->profiler->disable();
|
|
||||||
|
|
||||||
if (null !== $this->cspHandler) {
|
if (null !== $this->cspHandler) {
|
||||||
$this->cspHandler->disableCsp();
|
$this->cspHandler->disableCsp();
|
||||||
@ -231,11 +219,7 @@ class ProfilerController
|
|||||||
*/
|
*/
|
||||||
public function searchResultsAction(Request $request, $token)
|
public function searchResultsAction(Request $request, $token)
|
||||||
{
|
{
|
||||||
if (null === $this->profiler) {
|
$this->denyAccessIfProfilerDisabled();
|
||||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->profiler->disable();
|
|
||||||
|
|
||||||
if (null !== $this->cspHandler) {
|
if (null !== $this->cspHandler) {
|
||||||
$this->cspHandler->disableCsp();
|
$this->cspHandler->disableCsp();
|
||||||
@ -276,11 +260,7 @@ class ProfilerController
|
|||||||
*/
|
*/
|
||||||
public function searchAction(Request $request)
|
public function searchAction(Request $request)
|
||||||
{
|
{
|
||||||
if (null === $this->profiler) {
|
$this->denyAccessIfProfilerDisabled();
|
||||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->profiler->disable();
|
|
||||||
|
|
||||||
$ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip'));
|
$ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip'));
|
||||||
$method = $request->query->get('method');
|
$method = $request->query->get('method');
|
||||||
@ -331,11 +311,7 @@ class ProfilerController
|
|||||||
*/
|
*/
|
||||||
public function phpinfoAction()
|
public function phpinfoAction()
|
||||||
{
|
{
|
||||||
if (null === $this->profiler) {
|
$this->denyAccessIfProfilerDisabled();
|
||||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->profiler->disable();
|
|
||||||
|
|
||||||
if (null !== $this->cspHandler) {
|
if (null !== $this->cspHandler) {
|
||||||
$this->cspHandler->disableCsp();
|
$this->cspHandler->disableCsp();
|
||||||
@ -394,6 +370,15 @@ class ProfilerController
|
|||||||
|
|
||||||
return $this->templateManager;
|
return $this->templateManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function denyAccessIfProfilerDisabled()
|
||||||
|
{
|
||||||
|
if (null === $this->profiler) {
|
||||||
|
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->profiler->disable();
|
||||||
|
}
|
||||||
|
|
||||||
private function renderWithCspNonces(Request $request, $template, $variables, $code = 200, $headers = ['Content-Type' => 'text/html'])
|
private function renderWithCspNonces(Request $request, $template, $variables, $code = 200, $headers = ['Content-Type' => 'text/html'])
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user