#39 ✓resolved
humancopy

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

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.

New ticket Create new ticket

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

Pages