From d21ca6e31f81d73c4476d61ca1fe5d183371b9f3 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Fri, 4 Dec 2009 08:06:56 +0000 Subject: [PATCH] Error_Assertion: Only log assertion failures. Instead of throwing an exception for all assertion failures, simply log an error with a stack trace. PHP will still abort execution if assert.bail is enabled. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2027 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Error/Assertion.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/SimpleSAML/Error/Assertion.php b/lib/SimpleSAML/Error/Assertion.php index 67b27d13f..10bb386ce 100644 --- a/lib/SimpleSAML/Error/Assertion.php +++ b/lib/SimpleSAML/Error/Assertion.php @@ -52,8 +52,8 @@ class SimpleSAML_Error_Assertion extends SimpleSAML_Error_Exception { * disabled. */ public static function installHandler() { + assert_options(ASSERT_WARNING, 0); - assert_options(ASSERT_BAIL, 0); assert_options(ASSERT_QUIET_EVAL, 0); assert_options(ASSERT_CALLBACK, array('SimpleSAML_Error_Assertion', 'onAssertion')); } @@ -71,10 +71,12 @@ class SimpleSAML_Error_Assertion extends SimpleSAML_Error_Exception { public static function onAssertion($file, $line, $message) { if(!empty($message)) { - throw new self($message); + $exception = new self($message); } else { - throw new self(); + $exception = new self(); } + + $exception->logError(); } -} \ No newline at end of file +} -- GitLab