}
}
+ // Use the custom fatalErrorHandler if defined
+ if ($config->fatalErrorHandler && function_exists($config->fatalErrorHandler)) {
+ $name = $config->fatalErrorHandler;
+ $vars = [
+ 'pearError' => $pearError,
+ ];
+ $ret = $name($vars);
+ if ($ret) {
+ // the call has been successfully handled so we just exit
+ self::abend(CRM_Core_Error::FATAL_ERROR);
+ }
+ }
+
$template->assign_by_ref('error', $error);
$errorDetails = CRM_Core_Error::debug('', $error, FALSE);
$template->assign_by_ref('errorDetails', $errorDetails);
exit;
}
$runOnce = TRUE;
- self::abend(1);
+ self::abend(CRM_Core_Error::FATAL_ERROR);
}
/**
}
$file_log->close();
+ // Use the custom fatalErrorHandler if defined
+ if (in_array($priority, [PEAR_LOG_EMERG, PEAR_LOG_ALERT, PEAR_LOG_CRIT, PEAR_LOG_ERR])) {
+ if ($config->fatalErrorHandler && function_exists($config->fatalErrorHandler)) {
+ $name = $config->fatalErrorHandler;
+ $vars = [
+ 'debugLogMessage' => $message,
+ 'priority' => $priority,
+ ];
+ $name($vars);
+ }
+ }
+
if (!isset(\Civi::$statics[__CLASS__]['userFrameworkLogging'])) {
// Set it to FALSE first & then try to set it. This is to prevent a loop as calling
// $config->userFrameworkLogging can trigger DB queries & under log mode this
if (!empty(\Civi::$statics[__CLASS__]['userFrameworkLogging'])) {
// should call $config->userSystem->logger($message) here - but I got a situation where userSystem was not an object - not sure why
if ($config->userSystem->is_drupal and function_exists('watchdog')) {
- watchdog('civicrm', '%message', ['%message' => $message], isset($priority) ? $priority : WATCHDOG_DEBUG);
+ watchdog('civicrm', '%message', ['%message' => $message], $priority ?? WATCHDOG_DEBUG);
}
}
*
* @param string $prefix
*
- * @return Log
+ * @return Log_file
*/
public static function createDebugLogger($prefix = '') {
self::generateLogFileName($prefix);
$ret = [];
foreach ($backTrace as $trace) {
$args = [];
- $fnName = CRM_Utils_Array::value('function', $trace);
+ $fnName = $trace['function'] ?? NULL;
$className = isset($trace['class']) ? ($trace['class'] . $trace['type']) : '';
// Do not show args for a few password related functions
- $skipArgs = ($className == 'DB::' && $fnName == 'connect') ? TRUE : FALSE;
+ $skipArgs = $className == 'DB::' && $fnName == 'connect';
if (!empty($trace['args'])) {
foreach ($trace['args'] as $arg) {
*/
public static function deprecatedFunctionWarning($newMethod) {
$dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
- $callerFunction = isset($dbt[1]['function']) ? $dbt[1]['function'] : NULL;
- $callerClass = isset($dbt[1]['class']) ? $dbt[1]['class'] : NULL;
+ $callerFunction = $dbt[1]['function'] ?? NULL;
+ $callerClass = $dbt[1]['class'] ?? NULL;
Civi::log()->warning("Deprecated function $callerClass::$callerFunction, use $newMethod.", ['civi.tag' => 'deprecated']);
}