From 98cf7c1df99c034a243a1273bd507882f8779b87 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Wed, 15 Apr 2015 19:50:32 +0200
Subject: [PATCH] Fix buggy debug statements.

---
 modules/consent/lib/Auth/Process/Consent.php | 10 +++++-----
 modules/core/lib/ACL.php                     |  2 +-
 modules/core/templates/show_metadata.tpl.php |  2 +-
 modules/oauth/www/accessToken.php            |  3 ---
 modules/oauth/www/authorize.php              |  9 ---------
 modules/oauth/www/requestToken.php           |  3 ---
 modules/statistics/lib/Aggregator.php        |  2 +-
 modules/statistics/lib/LogCleaner.php        |  2 +-
 8 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php
index 9f77505c0..0cc895073 100644
--- a/modules/consent/lib/Auth/Process/Consent.php
+++ b/modules/consent/lib/Auth/Process/Consent.php
@@ -75,7 +75,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
             if (!is_bool($config['includeValues'])) {
                 throw new SimpleSAML_Error_Exception(
                     'Consent: includeValues must be boolean. ' .
-                    var_export($config['includeValues']) . ' given.'
+                    var_export($config['includeValues'], true) . ' given.'
                 );
             }
             $this->_includeValues = $config['includeValues'];
@@ -85,7 +85,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
             if (!is_bool($config['checked'])) {
                 throw new SimpleSAML_Error_Exception(
                     'Consent: checked must be boolean. ' .
-                    var_export($config['checked']) . ' given.'
+                    var_export($config['checked'], true) . ' given.'
                 );
             }
             $this->_checked = $config['checked'];
@@ -95,7 +95,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
             if (!in_array($config['focus'], array('yes', 'no'), true)) {
                 throw new SimpleSAML_Error_Exception(
                     'Consent: focus must be a string with values `yes` or `no`. ' .
-                    var_export($config['focus']) . ' given.'
+                    var_export($config['focus'], true) . ' given.'
                 );
             }
             $this->_focus = $config['focus'];
@@ -105,7 +105,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
             if (!is_array($config['hiddenAttributes'])) {
                 throw new SimpleSAML_Error_Exception(
                     'Consent: hiddenAttributes must be an array. ' .
-                    var_export($config['hiddenAttributes']) . ' given.'
+                    var_export($config['hiddenAttributes'], true) . ' given.'
                 );
             }
             $this->_hiddenAttributes = $config['hiddenAttributes'];
@@ -115,7 +115,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
             if (!is_array($config['noconsentattributes'])) {
                 throw new SimpleSAML_Error_Exception(
                     'Consent: noconsentattributes must be an array. ' .
-                    var_export($config['noconsentattributes']) . ' given.'
+                    var_export($config['noconsentattributes'], true) . ' given.'
                 );
             }
             $this->_noconsentattributes = $config['noconsentattributes'];
diff --git a/modules/core/lib/ACL.php b/modules/core/lib/ACL.php
index 65860ad17..724f18435 100644
--- a/modules/core/lib/ACL.php
+++ b/modules/core/lib/ACL.php
@@ -119,7 +119,7 @@ class sspmod_core_ACL {
 		case 'or':
 			return self::opOr($attributes, $rule);
 		default:
-			throw new SimpleSAML_Error_Exception('Invalid ACL operation: ' . var_export($op. TRUE));
+			throw new SimpleSAML_Error_Exception('Invalid ACL operation: ' . var_export($op, TRUE));
 		}
 	}
 
diff --git a/modules/core/templates/show_metadata.tpl.php b/modules/core/templates/show_metadata.tpl.php
index 6f6782f66..ff55e9c28 100644
--- a/modules/core/templates/show_metadata.tpl.php
+++ b/modules/core/templates/show_metadata.tpl.php
@@ -7,7 +7,7 @@ $this->includeAtTemplateBase('includes/header.php');
 
 echo('<pre style="font-size: 110%">');
 
-echo(htmlspecialchars(var_export($this->data['m'])));
+echo(htmlspecialchars(var_export($this->data['m'], true)));
 
 echo('</pre>');
 
diff --git a/modules/oauth/www/accessToken.php b/modules/oauth/www/accessToken.php
index af09b11a9..82eed1756 100644
--- a/modules/oauth/www/accessToken.php
+++ b/modules/oauth/www/accessToken.php
@@ -35,7 +35,4 @@ try {
 	
 	header('Content-type: text/plain; utf-8', TRUE, 500);
 	header('OAuth-Error: ' . $e->getMessage());
-
-	print_r($e);
-	
 }
diff --git a/modules/oauth/www/authorize.php b/modules/oauth/www/authorize.php
index 25fe1941a..afcc395b9 100644
--- a/modules/oauth/www/authorize.php
+++ b/modules/oauth/www/authorize.php
@@ -79,13 +79,4 @@ try {
 	
 	header('Content-type: text/plain; utf-8', TRUE, 500);
 	header('OAuth-Error: ' . $e->getMessage());
-
-	print_r($e);
-	
 }
-
-
-// 
-// $req = OAuthRequest::from_request();
-// $token = $server->fetch_request_token($req);
-// echo $token;
diff --git a/modules/oauth/www/requestToken.php b/modules/oauth/www/requestToken.php
index df861754a..3e270701c 100644
--- a/modules/oauth/www/requestToken.php
+++ b/modules/oauth/www/requestToken.php
@@ -26,7 +26,4 @@ try {
 	
 	header('Content-type: text/plain; utf-8', TRUE, 500);
 	header('OAuth-Error: ' . $e->getMessage());
-
-	print_r($e);
-	
 }
diff --git a/modules/statistics/lib/Aggregator.php b/modules/statistics/lib/Aggregator.php
index f588ca67f..f87772dd8 100644
--- a/modules/statistics/lib/Aggregator.php
+++ b/modules/statistics/lib/Aggregator.php
@@ -122,7 +122,7 @@ class sspmod_statistics_Aggregator {
 				echo("----------------------------------------\n");
 				echo('Log line: ' . $logline . "\n");
 				echo('Date parse [' . substr($logline, 0, $this->statconfig->getValue('datelength', 15)) . '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n");
-				print_r($content);
+				echo htmlentities(print_r($content, true));
 				if ($i >= 13) exit;
 			}
 			
diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php
index 55c7493e5..2cb496211 100644
--- a/modules/statistics/lib/LogCleaner.php
+++ b/modules/statistics/lib/LogCleaner.php
@@ -88,7 +88,7 @@ class sspmod_statistics_LogCleaner {
 				echo("----------------------------------------\n");
 				echo('Log line: ' . $logline . "\n");
 				echo('Date parse [' . substr($logline, 0, $this->statconfig->getValue('datelength', 15)) . '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n");
-				print_r($content);
+				echo htmlentities(print_r($content, true));
 				if ($i >= 13) exit;
 			}
 
-- 
GitLab