Bug Report #3931

Kohana_Exception::handler() doesn't exit with proper error codes

Added by Jeremy Bush about 1 year ago. Updated 4 months ago.

Status:Closed Start date:04/18/2011
Priority:Normal Due date:
Assignee:Jeremy Bush % Done:

100%

Category:Core
Target version:v3.0.11
Resolution:fixed Points:

Description

Kohana_Exception::handler() currently returns TRUE for many logic paths. It should always exit with a status code, since CLI jobs rely on these to determine if a job successfully ran or not. It should even exit this way in a web setting.


Subtasks

Bug Report #3932: Kohana_Exception::handler() doesn't exit with proper erro...ClosedJeremy Bush


Related issues

related to Kohana v3.x - Bug Report #4275: kohanaframework.org/3.2 Guide Error New 09/23/2011
related to Kohana v3.x - Feature Request #3989: Make Minion official v3.3.0 Closed 05/12/2011

Associated revisions

Revision f294337b
Added by Jeremy Bush about 1 year ago

Exception handler should always exit with an error code, Fixes #3931

History

Updated by Kiall Mac Innes about 1 year ago

https://github.com/kohana/core/blob/3.1%2Fmaster/classes/kohana/core.php#L508

and a few in this method:

https://github.com/kohana/core/blob/3.1%2Fmaster/classes/kohana/kohana/exception.php#L136

Might be more buried elsewhere...

All die() and exit()'s in system: (ignoring the file headers)

$ grep -r 'exit' *
classes/kohana/kohana/exception.php:            exit(1);
classes/kohana/request.php:        exit;
classes/kohana/response.php:        exit;
classes/kohana/response.php:            exit;
classes/kohana/core.php:            exit(1);
classes/kohana/core.php:            exit(1);
guide/kohana/tutorials/error-pages.md:                    exit(1);

$ grep -r 'die' * | grep -v 'direct' | grep -v 'tests' | grep -v 'Direct'
classes/kohana/core.php:            die;
guide/kohana/files/config.md:            'die' => 'dice', // does not exist in default config file

Updated by Jeremy Bush about 1 year ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:f294337b23a698c2162c1d8a489f6d32bc1a14c7.

Updated by Jeremy Bush about 1 year ago

  • Resolution set to fixed

Updated by Woody Gilk 4 months ago

This is a regression. We used to call exit in exception handlers, but doing so is broken behavior, as it prevents normal OOP overloading from functioning properly. I agree that CLI exit status matters, but this is throwing out the baby with the bath water.

Updated by Jeremy Bush 4 months ago

This should be changed as part of #3989.

Also available in: Atom PDF