From b4a2b0cff7c31ff1ffa0616284c9709b57abbc98 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 14 Jul 2009 14:06:07 +0000
Subject: [PATCH] _include.php: Limit the number of errors that will be logged.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1585 44740490-163a-0410-bde0-09ae8108e29a
---
 www/_include.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/www/_include.php b/www/_include.php
index 988d937df..f6a42f8c5 100644
--- a/www/_include.php
+++ b/www/_include.php
@@ -32,6 +32,13 @@ set_exception_handler('SimpleSAML_exception_handler');
 /* Log full backtrace on errors and warnings. */
 function SimpleSAML_error_handler($errno, $errstr, $errfile = NULL, $errline = 0, $errcontext = NULL) {
 
+	static $limit = 5;
+	$limit -= 1;
+	if ($limit < 0) {
+		/* We have reached the limit in the number of backtraces we will log. */
+		return FALSE;
+	}
+
 	/* Show an error with a full backtrace. */
 	$e = new SimpleSAML_Error_Exception('Error ' . $errno . ' - ' . $errstr);
 	$e->logError();
-- 
GitLab