Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[WebProfilerBundle] Rename the new exception controller and mark it as internal #32741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHANGELOG
* Added button to clear the ajax request tab
* Deprecated the `ExceptionController::templateExists()` method
* Deprecated the `TemplateManager::templateExists()` method
* Deprecated the `ExceptionController` in favor of `ExceptionErrorController`
* Deprecated the `ExceptionController` in favor of `ExceptionPanelController`
* Marked all classes of the WebProfilerBundle as internal

4.3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
use Twig\Error\LoaderError;
use Twig\Loader\ExistsLoaderInterface;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ExceptionController::class, ExceptionErrorController::class), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ExceptionController::class, ExceptionPanelController::class), E_USER_DEPRECATED);

/**
* ExceptionController.
*
* @author Fabien Potencier <[email protected]>
*
* @deprecated since Symfony 4.4, use the ExceptionErrorController instead.
* @internal since Symfony 4.4
* @deprecated since Symfony 4.4, use the ExceptionPanelController instead.
*/
class ExceptionController
{
Expand Down Expand Up @@ -106,7 +105,7 @@ public function cssAction($token)

$template = $this->getTemplate();

if (!$this->templateExists($template, false)) {
if (!$this->templateExists($template)) {
return new Response($this->errorRenderer->getStylesheet(), 200, ['Content-Type' => 'text/css']);
}

Expand All @@ -118,15 +117,8 @@ protected function getTemplate()
return '@Twig/Exception/'.($this->debug ? 'exception' : 'error').'.html.twig';
}

/**
* @deprecated since Symfony 4.4
*/
protected function templateExists($template/*, bool $triggerDeprecation = true */)
protected function templateExists($template)
{
if (1 === \func_num_args()) {
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use the "exists()" method of the Twig loader instead.', __METHOD__), E_USER_DEPRECATED);
}

$loader = $this->twig->getLoader();
if ($loader instanceof ExistsLoaderInterface) {
return $loader->exists($template);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
* Renders the exception panel.
*
* @author Yonel Ceruto <[email protected]>
*
* @internal
*/
class ExceptionErrorController
class ExceptionPanelController
{
private $htmlErrorRenderer;
private $profiler;
Expand All @@ -46,14 +48,14 @@ public function body(string $token): Response
->getException()
;

return new Response($this->htmlErrorRenderer->getBody($exception));
return new Response($this->htmlErrorRenderer->getBody($exception), 200, ['Content-Type' => 'text/html']);
}

/**
* Renders the exception panel stylesheet.
*/
public function stylesheet(): Response
{
return new Response($this->htmlErrorRenderer->getStylesheet());
return new Response($this->htmlErrorRenderer->getStylesheet(), 200, ['Content-Type' => 'text/css']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
<argument>%kernel.debug%</argument>
<argument type="service" id="debug.file_link_formatter" />
<argument type="service" id="error_renderer.renderer.html" />
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4, use the "web_profiler.controller.exception_error" service instead.</deprecated>
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4, use the "web_profiler.controller.exception_panel" service instead.</deprecated>
</service>

<service id="web_profiler.controller.exception_error" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionErrorController" public="true">
<service id="web_profiler.controller.exception_panel" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionPanelController" public="true">
<argument type="service" id="error_renderer.renderer.html" />
<argument type="service" id="profiler" on-invalid="null" />
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
</route>

<route id="_profiler_exception" path="/{token}/exception">
<default key="_controller">web_profiler.controller.exception_error::body</default>
<default key="_controller">web_profiler.controller.exception_panel::body</default>
</route>

<route id="_profiler_exception_css" path="/{token}/exception.css">
<default key="_controller">web_profiler.controller.exception_error::stylesheet</default>
<default key="_controller">web_profiler.controller.exception_panel::stylesheet</default>
</route>

</routes>