From d9519d43f741550bdc271a8075375fa17379e04c Mon Sep 17 00:00:00 2001 From: maliayas Date: Wed, 25 Jan 2012 01:28:48 +0200 Subject: [PATCH 1/2] Some bug fixes. Better display of NULL, TRUE and FALSE. --- dBug.php | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/dBug.php b/dBug.php index bc109b7..a121a63 100755 --- a/dBug.php +++ b/dBug.php @@ -2,6 +2,8 @@ /*********************************************************************************************************************\ * LAST UPDATE * ============ + * Sep 29, 2011 by maliayas + * July 25, 2011 by maliayas * March 22, 2007 * * @@ -96,12 +98,12 @@ function getVariableName() { if(isset($arrFile)) { $arrLines = file($arrFile["file"]); - $code = $arrLines[($arrFile["line"]-1)]; + $code = @$arrLines[($arrFile["line"]-1)]; //find call to dBug class - preg_match('/\bnew dBug\s*\(\s*(.+)\s*\);/i', $code, $arrMatches); + preg_match('/\bnew\s+dBug\s*\(\s*(.+?)\s*\)\s*;/i', $code, $arrMatches); - return $arrMatches[1]; + return @$arrMatches[1]; } return ""; } @@ -161,21 +163,26 @@ function checkType($var) { $this->varIsBoolean($var); break; default: - $var=($var=="") ? "[empty string]" : $var; - echo "\n\n\n
".$var."
\n"; + $this->makeTableHeader('simpleVar',gettype($var)); + $var=($var==="") ? "[empty string]" : $var; + //echo "\n\n\n
".$var."
\n"; + echo '' . htmlspecialchars($var) . ''; + echo ""; + break; } } //if variable is a NULL type function varIsNULL() { - echo "NULL"; + $this->makeTableHeader('simpleVar',"null"); + echo ""; } //if variable is a boolean type function varIsBoolean($var) { - $var=($var==1) ? "TRUE" : "FALSE"; - echo $var; + $this->makeTableHeader('simpleVar',($var==1) ? "true" : "false"); + echo ""; } //if variable is an array type @@ -199,7 +206,7 @@ function varIsArray($var) { $this->checkType($value); else { $value=(trim($value)=="") ? "[empty string]" : $value; - echo $value; + echo htmlspecialchars($value); } echo $this->closeTDRow(); } @@ -232,7 +239,7 @@ function varIsObject($var) { } if(in_array(gettype($value),$this->arrType)) $this->checkType($value); - else echo $value; + else echo htmlspecialchars($value); echo $this->closeTDRow(); } $arrObjMethods=get_class_methods(get_class($var)); @@ -478,22 +485,32 @@ function dBug_toggleTable(source) {