Skip to content
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

Kohana_Core::error_handler bypasses HTTP_Exception_500 handlers #598

Open
baronmog opened this issue Jan 24, 2015 · 2 comments
Open

Kohana_Core::error_handler bypasses HTTP_Exception_500 handlers #598

baronmog opened this issue Jan 24, 2015 · 2 comments
Labels
Milestone

Comments

@baronmog
Copy link

In Kohana/Core.php:990, the error_handler() function throws ErrorException (not HTTP_Exception), which leads to Kohana_Exception::_handler() manually creating a response with a status of 500, bypassing both the HTTP_Exception_500 and generic HTTP_Exception handlers.

public static function error_handler($code, $error, $file = NULL, $line = NULL)
{
    if (error_reporting() & $code)
    {
        // This error is not suppressed by current error reporting settings
        // Convert the error into an ErrorException
        throw new ErrorException($error, $code, 0, $file, $line);
    }

    // Do not execute the PHP error handler
    return TRUE;
}
@enov
Copy link
Contributor

enov commented Jan 24, 2015

I think it is OK to throw an ErrorException at that line.

Probably Kohana_Exception should be converted to an HTTP_Exception here:
https://github.com/kohana/core/blob/3.4/develop/classes/Kohana/Request/Client/Internal.php#L125

Should we revisit Kohana_Exception? Being the top most Exception in Kohana, it should not know about its child HTTP_Exception, and should not generate a Response with a View. Also it has 2 handler functions, one with underscore.

@neo22s neo22s added this to the 4.0.0 milestone Mar 21, 2016
@neo22s
Copy link
Member

neo22s commented Mar 21, 2016

Review with new exception for PHP7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants