summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-03-02 12:16:05 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-03-02 12:16:05 +0100
commit6ccb4788f6c44e8c67e27507e36ebe583a6a0d86 (patch)
tree61d7df874b66b368d05531e77d08129ed667ff31 /index.php
parente9e9e635b337dc46111cdf95ccb16b7d28deb849 (diff)
Improve assertion handling
Enable it explicitly and make sure a failed assertion will always terminate execution. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'index.php')
-rw-r--r--index.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/index.php b/index.php
index ebf1667e6..a88fcb21e 100644
--- a/index.php
+++ b/index.php
@@ -297,6 +297,14 @@ function check_for_fatal()
}
register_shutdown_function("check_for_fatal");
+function _assert_failure($file, $line, $expr, $message = "")
+{
+ _actual_exception_handler(new Exception("assert($expr): Assertion failed in $file at line $line".($message != "" ? " with message: '$message'" : "")));
+ exit(1);
+}
+
+assert_options(ASSERT_ACTIVE, true);
+assert_options(ASSERT_CALLBACK, '_assert_failure');
/*
* --------------------------------------------------------------------
* LOAD THE BOOTSTRAP FILE