halt not halting
Reported by humancopy | April 29th, 2010 @ 09:54 PM
hey
was trying to use halt like this, in the middle of
controller:
halt(NOT_FOUND, 'Please check url.');
but halt didn't stop the loading of the page.
i found that it gets to error_handler_dispatcher and
there's no exit at the end...
$handlers = error();
$is_http_err = http_response_status_is_valid($errno);
foreach($handlers as $handler)
{
$e = is_array($handler['errno']) ? $handler['errno'] : array($handler['errno']);
while($ee = array_shift($e))
{
if($ee == $errno || $ee == E_LIM_PHP || ($ee == E_LIM_HTTP && $is_http_err))
{
echo call_if_exists($handler['function'], $errno, $errstr, $errfile, $errline);
exit;
}
}
}
echo error_default_handler($errno, $errstr, $errfile, $errline);
there is exit only if error() is being used first. otherwise it
goes to the end, runs error_default_handler and then
continues with the controller.
once adding exit; after error_default_handler it
halts...
other option i found is to duplicate
error_default_handler as http_errors and then
call error() like this:
error(E_LIM_HTTP, 'http_errors');
this also make it halt... :)
thanks.
Comments and changes to this ticket
-
Fabrice Luraine May 15th, 2010 @ 04:22 PM
- State changed from new to resolved
(from [264fa0cf61c0defbcb5de7629290867406b80fa9]) Fixing error_handler_dispatch: now exit properly after errors that stop application [#39 state:resolved] http://github.com/sofadesign/limonade/commit/264fa0cf61c0defbcb5de7...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Limonade is a PHP micro-framework.
People watching this ticket
Tags
Referenced by
- 39 halt not halting (from [264fa0cf61c0defbcb5de7629290867406b80fa9]) Fixing ...