From 8259f1aaaef4999ee39e56e49f894edb4252031a Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Wed, 18 Apr 2007 19:41:51 +0200
Subject: [PATCH] fix dbg_backtrace when arguments are an array or object

darcs-hash:20070418174151-7ad00-834f13a1a0c84254cf98058c3e6db223187598ed.gz
---
 inc/infoutils.php | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/inc/infoutils.php b/inc/infoutils.php
index d6da2989d..255b49ed4 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -277,12 +277,23 @@ function dbg_backtrace(){
     $function = (isset($call['class'])) ?
     $call['class'] . $call['type'] . $call['function'] : $call['function'];
 
-    $params = '';
-    if (isset($call['args'])) {
-      $params = implode(', ', $call['args']);
+    $params = array();
+    if (isset($call['args'])){
+        foreach($call['args'] as $arg){
+            if(is_object($arg)){
+                $params[] = '[Object '.get_class($arg).']';
+            }elseif(is_array($arg)){
+                $params[] = '[Array]';
+            }elseif(is_null($arg)){
+                $param[] = '[NULL]';
+            }else{
+                $params[] = (string) '"'.$arg.'"';
+            }
+        }
     }
+    $params = implode(', ',$params);
 
-    $calls[$depth - $i] = sprintf('%s(%s) called at [%s]',
+    $calls[$depth - $i] = sprintf('%s(%s) called at %s',
                           $function,
                           str_replace("\n", '\n', $params),
                           $location);
-- 
GitLab