From c2837a94eafc79949de8d89938f5095517676a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20P=C3=A9rez=20Crespo?= <jaime.perez@uninett.no> Date: Mon, 6 Jan 2014 16:42:23 +0000 Subject: [PATCH] Fix for issue #584. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3314 44740490-163a-0410-bde0-09ae8108e29a --- config-templates/config.php | 9 ++++++++- lib/SimpleSAML/Error/Error.php | 3 ++- www/errorreport.php | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config-templates/config.php b/config-templates/config.php index ca7f2e463..66d1cf49e 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -46,8 +46,15 @@ $config = array ( */ 'debug' => FALSE, - + /* + * When showerrors is enabled, all error messages and stack traces will be output + * to the browser. + * + * When errorreporting is enabled, a form will be presented for the user to report + * the error to technicalcontact_email. + */ 'showerrors' => TRUE, + 'errorreporting' => TRUE, /** * Custom error show function called from SimpleSAML_Error_Error::show. diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php index 86de994b0..ff1870863 100644 --- a/lib/SimpleSAML/Error/Error.php +++ b/lib/SimpleSAML/Error/Error.php @@ -263,7 +263,8 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception { $data['includeTemplate'] = $this->includeTemplate; /* Check if there is a valid technical contact email address. */ - if($config->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') { + if($config->getBoolean('errorreporting', TRUE) && + $config->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') { /* Enable error reporting. */ $baseurl = SimpleSAML_Utilities::getBaseURL(); $data['errorReportAddress'] = $baseurl . 'errorreport.php'; diff --git a/www/errorreport.php b/www/errorreport.php index 8d98f0e82..101eae951 100644 --- a/www/errorreport.php +++ b/www/errorreport.php @@ -91,7 +91,7 @@ if (!preg_match('/\s/', $email) && strpos($email, '@') !== FALSE) { /* Send the email. */ $toAddress = $config->getString('technicalcontact_email', 'na@example.org'); -if ($toAddress !== 'na@example.org') { +if ($config->getBoolean('errorreporting', TRUE) && $toAddress !== 'na@example.org') { $email = new SimpleSAML_XHTML_EMail($toAddress, 'simpleSAMLphp error report', $from); $email->setBody($message); $email->send(); -- GitLab