Skip to content
Snippets Groups Projects
Commit d21ca6e3 authored by Olav Morken's avatar Olav Morken
Browse files

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
parent 62d4c3e0
No related branches found
No related tags found
No related merge requests found
...@@ -52,8 +52,8 @@ class SimpleSAML_Error_Assertion extends SimpleSAML_Error_Exception { ...@@ -52,8 +52,8 @@ class SimpleSAML_Error_Assertion extends SimpleSAML_Error_Exception {
* disabled. * disabled.
*/ */
public static function installHandler() { public static function installHandler() {
assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_BAIL, 0);
assert_options(ASSERT_QUIET_EVAL, 0); assert_options(ASSERT_QUIET_EVAL, 0);
assert_options(ASSERT_CALLBACK, array('SimpleSAML_Error_Assertion', 'onAssertion')); assert_options(ASSERT_CALLBACK, array('SimpleSAML_Error_Assertion', 'onAssertion'));
} }
...@@ -71,10 +71,12 @@ class SimpleSAML_Error_Assertion extends SimpleSAML_Error_Exception { ...@@ -71,10 +71,12 @@ class SimpleSAML_Error_Assertion extends SimpleSAML_Error_Exception {
public static function onAssertion($file, $line, $message) { public static function onAssertion($file, $line, $message) {
if(!empty($message)) { if(!empty($message)) {
throw new self($message); $exception = new self($message);
} else { } else {
throw new self(); $exception = new self();
} }
$exception->logError();
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment