Skip to content

[HttpKernel] scripts stops when missing DebugClassLoader and no error #7406

@sstok

Description

@sstok

When the HttpKernel is used in debugging mode and the ClassLoader component is not installed no error is shown and the script stops with an exit code 255 (fatal error).

display_errors is set to 0 before the class is actually loaded, so no error is shown.

ini_set('display_errors', 0); // when you comment this line the error is shown (Fatal error: Class 'Symfony\Component\ClassLoader\DebugClassLoader' not found in [...])

if ($this->debug) {
    error_reporting(-1);

    DebugClassLoader::enable();
    ErrorHandler::register($this->errorReportingLevel);
    if ('cli' !== php_sapi_name()) {
        ExceptionHandler::register();
    } else {
        ini_set('display_errors', 1);
    }
}

I did not open a pull request as I'm not sure if its better to detect if the class is missing and thrown an exception telling to install the ClassLoader component or set the error_reporting later.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions