本文整理汇总了PHP中_exception_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP _exception_handler函数的具体用法?PHP _exception_handler怎么用?PHP _exception_handler使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_exception_handler函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ark_handle_shutdown
function ark_handle_shutdown()
{
$error = error_get_last();
if (isset($error)) {
_exception_handler($error['type'], $error['message'], $error['file'], $error['line']);
}
}
示例2: __call
public function __call($method, $args = array())
{
if (in_array($method, $this->methods)) {
return call_user_func_array(array($this->parent, $method), $args);
}
$trace = debug_backtrace();
_exception_handler(E_ERROR, "No such method '{$method}'", $trace[1]['file'], $trace[1]['line']);
exit;
}
示例3: ExceptionHandler
public function ExceptionHandler(Exception $exception)
{
$class = get_class($exception);
$message = $exception->getMessage();
$file = $exception->getFile();
$line = $exception->getLine();
$error = sprintf("Uncaught exception '%s' with message '%s'", $class, $message);
// give CI a chance to handle the error (display message, logging)
_exception_handler(E_ERROR, $error, $file, $line);
// bubble up if necessary
if ($this->previousHandler) {
$this->previousHandler($exception);
}
// let PHP handle the rest.
throw $exception;
}
示例4: phpFunctions
public function phpFunctions()
{
$arg_list = func_get_args();
$function = array_shift($arg_list);
if (is_callable($function)) {
return call_user_func_array($function, $arg_list);
}
if (!$this->env->isDebug()) {
return null;
}
$trace = debug_backtrace(null, 2);
$debugInfo = $this->getDebugInfo($trace);
$errMsg = 'Called to an undefined function : <b>php_' . $function . "</b> ";
if (isset($debugInfo['file'], $debugInfo['line'])) {
_exception_handler(E_USER_NOTICE, $errMsg, $debugInfo['file'], $debugInfo['line']);
} else {
trigger_error($errMsg, E_USER_NOTICE);
}
return NULL;
}
示例5: _shutdown_handler
/**
* Shutdown Handler
*
* This is the shutdown handler that is declared at the top
* of CodeIgniter.php. The main reason we use this is to simulate
* a complete custom exception handler.
*
* E_STRICT is purposivly neglected because such events may have
* been caught. Duplication or none? None is preferred for now.
*
* @link http://insomanic.me.uk/post/229851073/php-trick-catching-fatal-errors-e-error-with-a
* @return void
*/
function _shutdown_handler()
{
$last_error = error_get_last();
if (isset($last_error) && $last_error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING)) {
_exception_handler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']);
}
}
示例6: http_build_query
function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL)
{
// Check the data
if (!is_array($formdata) && !is_object($formdata)) {
$backtrace = debug_backtrace();
_exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
return FALSE;
}
// Cast it as array
if (is_object($formdata)) {
$formdata = get_object_vars($formdata);
}
// If the array is empty, return NULL
if (empty($formdata)) {
return NULL;
}
// Argument separator
if ($separator === NULL) {
$separator = ini_get('arg_separator.output');
if (strlen($separator) == 0) {
$separator = '&';
}
}
// Start building the query
$tmp = array();
foreach ($formdata as $key => $val) {
if ($val === NULL) {
continue;
}
if (is_integer($key) && $numeric_prefix != NULL) {
$key = $numeric_prefix . $key;
}
if (is_resource($val)) {
return NULL;
}
// hand it off to a recursive parser
$tmp[] = _http_build_query_helper($key, $val, $separator);
}
return implode($separator, $tmp);
}
示例7: call_user_func_array
*/
$EXT->call_hook('post_controller_constructor');
/*
* ------------------------------------------------------
* Call the requested method
* ------------------------------------------------------
*/
try {
call_user_func_array(array(&$CI, $method), $params);
} catch (Exception $exception) {
$OUT->set_status_header($exception->getCode(), lang($exception->getMessage()));
if (!$IN->accept('application/json')) {
if (in_array(ENVIRONMENT, array('testing', 'production'))) {
show_error(lang($exception->getMessage()), $exception->getCode());
} elseif (ENVIRONMENT === 'development') {
_exception_handler(E_NOTICE, lang($exception->getMessage()), $exception->getFile(), $exception->getLine());
}
}
}
// Mark a benchmark end point
$BM->mark('controller_execution_time_( ' . $class . ' / ' . $method . ' )_end');
/*
* ------------------------------------------------------
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
$EXT->call_hook('post_controller');
/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
示例8: _handle_exception
/**
* @param $methodName
* @return null
*/
private function _handle_exception($methodName)
{
if (!function_exists('_exception_handler')) {
return null;
}
$trace = debug_backtrace(null, 1);
$errMsg = 'Undefined method : ' . get_class($this) . "::" . $methodName . " called";
_exception_handler(E_USER_NOTICE, $errMsg, $trace[0]['file'], $trace[0]['line']);
}