From 07c3deaeb5fced19f614ef46047c5de285033a97 Mon Sep 17 00:00:00 2001 From: Marcus Puchalla Date: Tue, 16 Dec 2014 13:44:35 +0100 Subject: [PATCH 1/3] Added 4th parameter to dBug constructor. With this optional parameter, that is false by default, you can trigger the init of the JS and CSS. This is needed if you want to use dBug multiple time to e.g. create multiple files (using ob_start etc. ). Until now it would only generate those sections on the first constructor call. --- dBug.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dBug.php b/dBug.php index 09107d2..6302e91 100755 --- a/dBug.php +++ b/dBug.php @@ -66,12 +66,14 @@ class dBug { var $arrHistory = array(); //constructor - function dBug($var,$forceType="",$bCollapsed=false) { + function dBug($var,$forceType="",$bCollapsed=false, $reinit = false) { //include js and css scripts - if(!defined('BDBUGINIT')) { - define("BDBUGINIT", TRUE); - $this->initJSandCSS(); - } + if(!defined('BDBUGINIT') || $reinit) { + if(!defined('BDBUGINIT')){ + define("BDBUGINIT", TRUE); + } + $this->initJSandCSS(); + } $arrAccept=array("array","object","xml"); //array of variable types that can be "forced" $this->bCollapsed = $bCollapsed; if(in_array($forceType,$arrAccept)) From 86dacf82040ed6edefb411d083dc815413d859be Mon Sep 17 00:00:00 2001 From: Marcus Puchalla Date: Thu, 16 Apr 2015 09:09:14 +0200 Subject: [PATCH 2/3] Header outut modification: - The dump of an object will now also print its class name in the header. - Array dumps will include the array size. - Resources will display their type (get_resource_type). --- dBug.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dBug.php b/dBug.php index 6302e91..439fe76 100755 --- a/dBug.php +++ b/dBug.php @@ -190,7 +190,7 @@ class dBug { $var_ser = serialize($var); array_push($this->arrHistory, $var_ser); - $this->makeTableHeader("array","array"); + $this->makeTableHeader("array","array (size: ".sizeof($var).")"); if(is_array($var)) { foreach($var as $key=>$value) { $this->makeTDHeader("array",$key); @@ -220,7 +220,7 @@ class dBug { function varIsObject($var) { $var_ser = serialize($var); array_push($this->arrHistory, $var_ser); - $this->makeTableHeader("object","object"); + $this->makeTableHeader("object","object .(".get_class($var).")"); if(is_object($var)) { $arrObjVars=get_object_vars($var); @@ -255,7 +255,7 @@ class dBug { //if variable is a resource type function varIsResource($var) { - $this->makeTableHeader("resourceC","resource",1); + $this->makeTableHeader("resourceC","resource (".get_resource_type($var).")",1); echo "\n\n"; switch(get_resource_type($var)) { case "fbsql result": From d85f1013bdaa5be918730af7675d6c79ad22f311 Mon Sep 17 00:00:00 2001 From: Marcus Puchalla Date: Tue, 22 Aug 2017 11:35:55 +0200 Subject: [PATCH 3/3] Change dBug constructor function In order to prevent the error message. "Methods with the same name as their class will not be constructors in a future version of PHP" --- dBug.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dBug.php b/dBug.php index 439fe76..53da550 100755 --- a/dBug.php +++ b/dBug.php @@ -66,7 +66,7 @@ class dBug { var $arrHistory = array(); //constructor - function dBug($var,$forceType="",$bCollapsed=false, $reinit = false) { + function __construct($var,$forceType="",$bCollapsed=false, $reinit = false) { //include js and css scripts if(!defined('BDBUGINIT') || $reinit) { if(!defined('BDBUGINIT')){