Skip to content

Commit

Permalink
Implement stop_and_exit with register_shutdown_function
Browse files Browse the repository at this point in the history
  • Loading branch information
sniemela authored and Fabrice Luraine committed Jan 19, 2010
1 parent 23081c0 commit 87eff45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion TODO
Expand Up @@ -21,7 +21,6 @@ autoload_controller(['function']);
- improving unregister_globals
- to avoid predefined variables (_SERVER, _REQUEST...) deletion
- to handle session globals by calling unregister_globals('_SESSION') after session start
- implements stop_and_exit() call with register_shutdown_function
- deleting deprecated ['HTTP_SERVER_VARS'], ['HTTP_GET_VARS']... (<http://www.php.net/manual/fr/reserved.variables.post.php>...)
- implement user agent detection option in routing
- params function should be singular like option ?
Expand Down
8 changes: 5 additions & 3 deletions lib/limonade.php
Expand Up @@ -331,9 +331,13 @@ function run($env = null)
// X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
// X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5

# 1. Set error handling
# 1. Set handlers
# 1.1 Set error handling
ini_set('display_errors', 1);
set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);

# 1.2 Register shutdown function
register_shutdown_function('stop_and_exit');

# 2. Set user configuration
call_if_exists('configure');
Expand Down Expand Up @@ -390,7 +394,6 @@ function route_missing($request_method, $request_uri)
{
echo after(error_notices_render() . $output);
}
stop_and_exit();
}
else halt(SERVER_ERROR, "Routing error: undefined function '{$route['function']}'", $route);
}
Expand Down Expand Up @@ -623,7 +626,6 @@ function error_handler_dispatcher($errno, $errstr, $errfile, $errline)
}
}
echo error_default_handler($errno, $errstr, $errfile, $errline);
stop_and_exit();
}
}

Expand Down

0 comments on commit 87eff45

Please sign in to comment.