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)