1
0

upport 1b53092a21 exception tuning

mainly this was introduced to seperate db connect errors from tracing, while these errors carried security data in thrown trace path
This commit is contained in:
Ian
2013-04-08 20:08:35 +03:00
parent 4affeb3107
commit 4a317336fe

View File

@ -103,20 +103,36 @@ if (!function_exists('errorToExceptionHandler')) {
echo '<pre>';
// trying to be as detailled as possible - but beware using args containing sensibel data like passwords
if (function_exists('debug_backtrace') && version_compare(PHP_VERSION, '5.3.6') >= 0) {
$debugbacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if ( version_compare(PHP_VERSION, '5.4') >= 0 ) {
$debugbacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 8);
} else {
$debugbacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
print_r($debugbacktrace);
}
throw new ErrorException($errStr); // tracepath = all, if not ini_set('display_errors', 0);
//print_r($args); // debugging
// debugbacktrace is nice, but additional it is good to have the verbosity of SPL EXCEPTIONS, except for db connect errors
if (!$serendipity['dbConn']) {
echo '<p>' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '</p>';
} else {
throw new ErrorException($errStr); // tracepath = all, if not ini_set('display_errors', 0);
}
echo '</pre>'; // if using throw new ... this ending tag will not be send and displayed, but it still looks better and browsers don't really care
exit; // make sure to exit in case of database connection errors.
}
if ($serendipity['production'] === false) {
echo '<p> == TESTING ERROR MODE == </p>';
echo '<pre>';
//print_r($args); // do this in strong test environments only, as containing sensible data! Better use debug!
throw new ErrorException("Serendipity error: " . $errStr); // tracepath = all;
// it is good to have the verbosity of SPL EXCEPTIONS, except for db connect errors
if (!$serendipity['dbConn']) {
echo '<p>' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '</p>';
} else {
throw new ErrorException($errStr); // tracepath = all, if not ini_set('display_errors', 0);
}
echo '</pre>'; // if using throw new ... this ending tag will not be send and displayed, but it still looks better and browsers don't really care
exit; // make sure to exit in case of database connection errors.
}
if ($serendipity['production'] === true) {
// ToDo: enhance for more special serendipity error needs
$str = '<p> == SERENDIPITY ERROR == </p>';