diff options
-rw-r--r-- | it_debug.class | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/it_debug.class b/it_debug.class index 92753b2..bd81720 100644 --- a/it_debug.class +++ b/it_debug.class @@ -87,10 +87,33 @@ function dump($args) $src = $GLOBALS['it_debug::dump source'][$file][$line-1]; - $paramlist = preg_match('/(D|ED|EDC|EDX)\s*\(\s*([^)]+)/i', $src, $parts) ? $parts[2] : ""; - $argnames = preg_split('/\s*,\s*/', $paramlist); + list($function, $paramlist) = it::match('\b(D|ED|EDC|EDX)\s*\((.*)', $src); + $paramtokens = token_get_all("<?php $paramlist"); + array_shift($paramtokens); + $param = ""; + foreach ($paramtokens as $token) + { + if ($token == "(") + $paramnesting++; + else if ($token == ")") + { + if (!$paramnesting--) # Found closing parens + { + $argnames[] = trim($param); + break; + } + } + + if (($token == ",") && !$paramnesting) + { + $argnames[] = trim($param); + $param = ""; + } + else + $param .= is_array($token) ? $token[1] : $token; + } - if ($parts[1] == "EDC") # First argument was stripped by EDC + if (it::match('^EDC$', $function)) # First argument was removed by EDC array_shift($argnames); foreach ($args as $arg) |