Skip to content

[HttpKernel][ErrorHandler] Undocumented BC with logging #53430

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

Closed
radar3301 opened this issue Jan 5, 2024 · 2 comments
Closed

[HttpKernel][ErrorHandler] Undocumented BC with logging #53430

radar3301 opened this issue Jan 5, 2024 · 2 comments

Comments

@radar3301
Copy link
Contributor

Symfony version(s) affected

6.4

Description

https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/ErrorHandler/CHANGELOG.md
nor
https://github.com/symfony/symfony/blob/6.4/CHANGELOG-6.4.md

do not document the Breaking Change from 6.3 in Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer
for the now required Symfony\Component\HttpKernel\Log\DebugLoggerConfigurator on line 143

How to reproduce

composer init
composer require symfony/error-handler

Create an index.php file with the contents:

<?php

use Symfony\Component\ErrorHandler\BufferingLogger;
use Symfony\Component\ErrorHandler\DebugClassLoader;
use Symfony\Component\ErrorHandler\ErrorHandler;

require __DIR__ . '/vendor/autoload.php';

ErrorHandler::register(new ErrorHandler(new BufferingLogger(), true));

throw new \RuntimeException();

Run php -S localhost:8000 index.php and navigate to localhost:8000

Result:
Fatal error: Uncaught Symfony\Component\ErrorHandler\Error\ClassNotFoundError: Attempted to load class "DebugLoggerConfigurator" from namespace "Symfony\Component\HttpKernel\Log".
Did you forget a "use" statement for another namespace? in D:\php\symfony-error-handler-test\vendor\symfony\error-handler\ErrorRenderer\HtmlErrorRenderer.php:143
Stack trace:
#0 D:\php\symfony-error-handler-test\vendor\symfony\error-handler\ErrorRenderer\HtmlErrorRenderer.php(70): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->renderException()
#1 D:\php\symfony-error-handler-test\vendor\symfony\error-handler\ErrorHandler.php(645): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->render()
#2 D:\php\symfony-error-handler-test\vendor\symfony\error-handler\ErrorHandler.php(531): Symfony\Component\ErrorHandler\ErrorHandler->renderException()
#3 [internal function]: Symfony\Component\ErrorHandler\ErrorHandler->handleException()
#4 {main}
thrown in D:\php\symfony-error-handler-test\vendor\symfony\error-handler\ErrorRenderer\HtmlErrorRenderer.php on line 143

Expected result (without the requirement of having to composer require symfony/http-kernel):
image

Possible Solution

Options:

  1. Document the breaking change
  2. Move the Symfony\Component\HttpKernel\Log classes into symfony/error-handler (symfony/monolog-bridge and symfony/framework-bundle and symfony/http-kernel both already require symfony/error-handler, see image) image
  3. Revert this change

Option 2 "shouldn't" cause any issues, and will end up requiring less dependencies overall.

Additional Context

none

@xabbuh
Copy link
Member

xabbuh commented Jan 5, 2024

Can you confirm that #53434 fixes this issue for you?

@radar3301
Copy link
Contributor Author

Can you confirm that #53434 fixes this issue for you?

Hmm, yeah that's a good option too. :)

Yes, it does.

fabpot added a commit that referenced this issue Jan 6, 2024
…ttpKernel component (xabbuh)

This PR was merged into the 6.4 branch.

Discussion
----------

[ErrorHandler] fix rendering exception pages without the HttpKernel component

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #53430
| License       | MIT

Commits
-------

172862c fix rendering exception pages without the HttpKernel component
@fabpot fabpot closed this as completed Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants