View Issue Details

IDProjectCategoryView StatusLast Update
386Exception_DefaultHandlerAllpublic27 Feb 2012 21:29
Reportermrosenquist Assigned Totimj  
PrioritynormalSeveritytweakReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.8.1 
Target Version0.8.2Fixed in Version0.8.2 
Summary386: Output the contents of the $_SESSION variable in e-mail report
DescriptiongetEnviroment could output the contents of the $_SESSION variable
TagsNo tags attached.
Attached Files
Exception_DefaultHandler.bug386.patch (1,655 bytes)   
Index: DefaultHandler.php
===================================================================
--- DefaultHandler.php	(revision 49242)
+++ DefaultHandler.php	(working copy)
@@ -452,21 +452,13 @@
 			
 			if (count($_POST) > 0) {
 				$error .= "HTTP POST variables:\n";
-				foreach ($_POST as $variable => $value) {
-					// TODO: Iterate this properly for arrays with >2 dimensions...
-					if (is_array($value)) {
-						foreach($value as $array_key => $array_value) {
-							if (is_scalar($array_value)) {
-								$error .= $variable . "[$array_key]: $array_value\n";
-							} else {
-								$error .= $variable . "[$array_key]: ". gettype($array_value) . "\n";
-							}
-						}
-					} else {
-						$error.= "$variable: $value\n";
-					}
-				}
+				$error .= self::getVariableOutput($_POST);
 			}
+			
+			if (isset($_SESSION) && count($_SESSION)>0) {
+				$error .= "HTTP SESSION variables:\n";
+				$error .= self::getVariableOutput($_SESSION);
+			}
 		}
 		
 		if (PHP_SAPI == 'cli') {
@@ -484,6 +476,21 @@
 		return $error;
 	}
 	
+	protected static function getVariableOutput($array, $prefix='')
+	{
+		foreach ($array as $variable => $value) {
+			$variable = empty($prefix)?$variable:$prefix . '[' . $variable . ']';
+			if (is_array($value)) {
+				$out .= self::getVariables($value, $variable);
+			} else if (is_scalar($array_value)) {
+				$out .= $variable . ": " . $value . "\n";
+			} else {
+				$out .= $variable . ": " . gettype($value) . "\n";
+			}
+		}
+		return $out;
+	}
+	
 	protected static function getPHPErrorDescription($errno)
 	{
 		// Types of error (from http://uk3.php.net/manual/en/errorfunc.constants.php)

Activities

timj

17 Oct 2011 12:12

administrator   ~393

Fixed along with bug 388 in SVN r2240. Thanks for the patch!

Issue History

Date Modified Username Field Change
30 Sep 2011 08:42 mrosenquist New Issue
30 Sep 2011 09:39 mrosenquist File Added: Exception_DefaultHandler.bug386.patch
14 Oct 2011 20:47 timj Category => All
17 Oct 2011 12:12 timj Note Added: 393
17 Oct 2011 12:12 timj Assigned To => timj
17 Oct 2011 12:12 timj Status new => resolved
17 Oct 2011 12:12 timj Resolution open => fixed
17 Oct 2011 12:12 timj Product Version => 0.8.1
17 Oct 2011 12:12 timj Fixed in Version => 0.8.2
17 Oct 2011 12:12 timj Target Version => 0.8.2
17 Oct 2011 12:12 timj Summary getEnviroment could output the contents of the $_SESSION variable => Output the contents of the $_SESSION variable in e-mail report
27 Feb 2012 21:29 timj Status resolved => closed