better asserting

This commit is contained in:
Shish
2015-07-19 19:04:35 +01:00
parent 90539a32bc
commit 2b6f3b7266
4 changed files with 48 additions and 36 deletions

View File

@@ -1441,6 +1441,19 @@ function get_debug_info() {
return $debug;
}
function score_assert_handler($file, $line, $code, $desc = null) {
$file = basename($file);
print("Assertion failed at $file:$line: $code ($desc)");
/*
print("<pre>");
debug_print_backtrace();
print("</pre>");
*/
}
//assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_QUIET_EVAL, 1);
assert_options(ASSERT_CALLBACK, 'score_assert_handler');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Request initialisation stuff *